Akamai CLI is an ever-growing CLI toolkit for working with Akamai's API from the command line.
- Simplicity
- Feature-full
- Consistent UX
Akamai CLI is itself a Go application, but may rely on sub-commands that can be written using any language and may require additional runtimes.
The easiest way to install Akamai CLI is to download a release binary for your platform.
Once you have downloaded the appropriate binary for your system, you must make it executable, and optionally move it somewhere within your path.
$ chmod +x ~/Downloads/akamai-<VERSION>-<PLATFORM>
$ mv ~/Downloads/akamai-<VERSION>-<PLATFORM> /usr/local/bin/akamaiOnce you have downloaded the appropriate binary for your system, no further actions are required on your part, simply execute the binary from the command line.
If you are using macOS, you can also install using the Homebrew package manager.
$ brew install akamaiThis will install all necessary dependencies, compile, and install the binary — which will then be available globally.
If you use (or want to use) docker, you can get a fully installed CLI instance by running:
$ docker run -ti akamaiopen/cliThe container contains Akamai CLI, as well as the purge and property subcommands pre-installed.
Note: When setting up your
.edgerc, thepurgesubcommand defaults to theccucredentials section, while thepropertysubcommand uses thepapisection. These can be changed using the--sectionflag.
If you want to compile it from source, you will need Go 1.7 or later, and the Glide package manager installed:
- Fetch the package:
go get github.com/akamai/cli - Change to the package directory:
cd $GOPATH/src/github.com/akamai/cli - Install dependencies using Glide:
glide install - Compile the binary:
- Linux/macOS/*nix:
go build -o akamai - Windows
go build -o akamai.exe
- Move the binary (
akamaiorakamai.exe) it to yourPATH
Akamai CLI uses the standard Akamai OPEN credentials file, .edgerc. By default, it will look for credentials in your HOME directory.
You can override both the credentials file location, or the section, by passing the the --edgerc or --section flags to each sub-command.
To set up your credential file, see the authorization and credentials sections of the Get Started guide.
All commands start with the akamai binary, followed by a sub-command which correlates directly to another binary in your path starting with akamai- or akamaiTitlecase (in the case of node.js binaries).
Calling akamai help will show basic usage info, and available commands. To learn more about a specific sub-command, use akamai help <command> [sub-command].
Calling akamai list will show you a list of available sub-commands. If a command is not shown, ensure that the binary is executable, and in your PATH.
The get command allows you to easily install new sub-commands from a git repository.
Calling akamai get <repo> will download and install the command repository to the $HOME/.akamai-cli directory.
For Github repositories, you can pass in user/repo or organization/repo.
To update a sub-command installed with akamai get, you call akamai update <command>.
Calling akamai update with no arguments will update all commands installed using akamai get
To call a sub-command, use akamai <sub-command> [args], e.g.
akamai property create example.orgAkamai CLI also provides a framework for writing custom CLI commands. There are a few requirements:
- The executable must be named
akamai-<command>orakamai<Command> - Help must be visible when you run:
akamai-command helpand ideally, should allow forakamai-command help <sub-command> - If using OPEN APIs, it must support the
.edgercformat, and must support both--edgercand--sectionflags - If the action fails to complete, it should return a non-zero status code (however,
akamaiwill only return0on success or1on failure)
You can use any language to build commands, so long as the result is executable — this includes PHP, Python, Ruby, Perl, Java, Golang, JavaScript, and C#.
You must include a cli.json file to inform Akamai CLI about the command package and it's included commands.
cli.json allows you specify the command language runtime version, as well as define all commands included in package.
{
"requirements": {
"go": "1.8.0"
},
"commands": [
{
"name": "purge",
"version": "0.1.0",
"description": "Purge content from the Edge",
"bin": "https://github.com/akamai/cli-purge/releases/download/{{.Version}}/akamai-{{.Name}}-{{.OS}}{{.Arch}}{{.BinSuffix}}"
}
]
}requirements— specify runtime requirements. You may specify a minimum version number or use*for any version. Possible requirements are:gophprubynodepython
commands— A list of commands included in the packagename— The command nameversion— The command versiondescription- The command descriptionusage- A usage string (shown after the command name)arguments— A list of argumentsbin— A url to fetch a binary package from if it cannot be installed from source
The bin URL may contain the following placeholders:
{{.Version}}— The command version{{.Name}}— The command name{{.OS}}— The current operating system- Possible values are:
windows,mac, orlinux
- Possible values are:
{{.Arch}}— The current OS architecture- Possible values are:
386,amd64
- Possible values are:
{{.BinSuffix}}— The binary suffix for the current OS- Possible values are:
.exefor windows
- Possible values are: