A command line interface for Akamai’s Adaptive Acceleration offering. It allows you to reset the A2 Push and Preconnect optimizations manually. It can be used in continuous deployment environments where popular resources change often or quickly.
First, install the Akamai CLI. Second, install the adaptive-acceleration CLI package with
akamai install adaptive-acceleration
Before you can use the CLI, you need to install API keys and find the id of the property you wish to reset.
Generate API keys with READ-WRITE available on the Adaptive Acceleration capability as described here
and save them to your
~/.edgerc file. Alternatively, you can also add the Adaptive Acceleration capability to your existing credentials.
Before you run the A2 reset command, you need to know the id of your property. That’s exposed in the Akamai Control Center, on the Automatic Push and Preconnect Policy page. To find it:
The command line is of the form
akamai a2 reset ### where
### is the property id. You can copy and paste the entire line into a terminal or script and run it:
akamai a2 reset 123456
If you want to check that the reset succeeded, use the exit code.
The exit code is 0 on success, or 1 in case of an error returned by the underlying API.
--edgerc value— Location of the credentials file (default: user’s directory like “/Users/vzaytsev/.edgerc”) [$AKAMAI_EDGERC]
--section value— Section of the credentials file to use (default: “default”) .
-d- prints concise debug information about network endpoints
-v- prints network headers and other communication information
-h— Show help
The flags are passed to the
adaptive-acceleration portion of the command-line:
$ akamai a2 --section default -v reset 123456 Reset policy for: 123456 LOG: POST https://akab-cjzide3ie87zpaeu-ta8p6mb7deapdkpu.luna.akamaiapis.net/adaptive-acceleration/v1/properties/123456/reset 204
If the API key you provisioned does not have permission to reset the given property, you will get the following message:
$ akamai a2 reset 459153 Reset policy for: 459153 ERROR: Call to https://akab-xyz.luna.akamaiapis.net/adaptive-acceleration/v1/properties/359153/reset failed with a 403 result ERROR: This indicates a problem with authorization. ERROR: Please ensure that the credentials you created for this script
You can resolve this by editing the permissions of the credentials you created to ensure they include READ-WRITE permissiong on Adaptive Acceleration for your account.