NetStorage CLI

The NetStorage command-line interface (CLI) is an add-on utility to the Akamai CLI that lets you interact with NetStorage storage groups from the command line. Use it to upload, download, and manage your content.

Before you begin

Before you install the NetStorage CLI package, you need to install the Akamai CLI.

The Akamai CLI is a powerful and extensible toolkit that allows you to manage and configure Akamai's platform and various products directly from the command line.

This is a short guide to get you started. For detailed Akamai CLI installation and usage, see the full Akamai CLI documentation.

Apply authentication credentials

To use the Akamai CLI, you need to apply your authentication credentials.

  1. Return to the API client for you page in ​Control Center​. It’s in the Identity and Access Management tool.

  2. Click Download in the Credentials section.

  1. Open the downloaded file with a text editor and add the value [default] as a header above all text. Your finished file should look like this:
  1. Save the file in your home directory using .edgerc as the filename. Here are some examples of the default home directory location for various operating systems:
/home/$USER/.edgerc
/Users/$USER/.edgerc
C:\Users\%USERNAME%\.edgerc

Install the Akamai CLI

You should consider the Docker image. ​Akamai​ offers several CLIs that you can use to interact with our APIs. With the Docker image installed, you can access them directly from your ​Akamai​ development environment.

👍

Akamai Docker Development Environment

We've bundled several tools together to make it easier for you. Check out the Docker section for more information. But, you can use the process discussed here to set up the Akamai CLI and NetStorage CLI utilities.

Download the binaries

Install the Akamai CLI by downloading and running a release binary for your operating system. A full list of the latest binaries is available on Github. We provide the list below for convenience.

Operating systemBinary
32-bit Linux (i386)akamai-1.4.1-linux386
64-bit Linux (AMD64)akamai-1.4.1-linuxamd64
64-bit Mac (AMD64)akamai-v1.4.1-macamd64
32-bit Windowsakamai-v1.4.1-windows386.exe
64-bit Windowsakamai-v1.4.1-windowsamd64.exe

Configure Akamai CLI for your system

  • For Linux and Mac. You need to make the Akamai CLI executable and optionally make it available in your $PATH.
  • Homebrew. You can install Akamai CLI using the Homebrew package manager. To install Homebrew, view the system requirements and install documentation.
  • Windows. The installation process can automatically add the Akamai CLI to your system path if you choose.

Run these commands as necessary for your system

$ chmod +x ~/Downloads/akamai-<VERSION>-<PLATFORM>
$ mv ~/Downloads/akamai-<VERSION>-<PLATFORM> /usr/local/bin/akamai
$ brew install akamai
$ akamai help

Install the NetStorage CLI

Installation of the NetStorage CLI requires the Akamai CLI. Use the Akamai CLI to install the netstorage CLI.

  1. Run this command to install NetStorage CLI:
akamai install netstorage
Akamai DevOps [/workdir] >> akamai install netstorage

Gather your NetStorage credentials

Once you've installed the NetStorage CLI, you need to gather your account information. You can use the NetStorage Configuration API or the NetStorage UI to gather these values:

  • HTTP API Keys. Copy the Key from the NetStorage HTTP CMS API tab.
  • Upload account Id. Copy the Id for the upload account from the Upload Account Details section..
  • Storage Group. Copy the name of the storage group, it serves as the group.
  • Upload Directory. Copy this value to serve as the CP Code.

Locate the required account information

  1. Open the application. Go to ORIGIN SERVICESNetStorage
  2. Access the Upload Accounts entity and locate the upload account you want to use. Click it to open the Detail View.
  3. Edit the upload account you want to use. Enable the HTTP CMS API if it's not already.
NetStorage Upload Accounts Screen

Apply your NetStorage credentials

Once you've installed the NetStorage CLI you need setup your configuration by appling the credentials you gathered previously.

  1. Run akamai netstorage setup to launch a wizard to configure your system. The first step is to enter the API Key you stored previously.
$ akamai netstorage setup

You will need to use the credential information from Luna.
?
The key field is displayed in the NetStorage HTTP API tab under Upload Accounts
Please input the following information: key: aBc123D7YWFw7DUel
  1. Enter your Upload account Id.
On the Upload Account Details page, this is the ID
Please input the following information: id: docteam
  1. Enter your Storage Group Id.
On the Upload Directory Association screen, this is in the second column
Please input the following information: group: mediadocs
  1. Enter your Hostname. See upload domains for each access method. This is typically [domain-name-prefix]-nsu.akamaihd.net.
In the Storage Group Details, you will find this value under NetStorage HTTP API.
Example: test111-nsu.akamaihd.net
Please input the following information: host: mediadocs-nsu.akamaihd.net
  1. Enter your CP code. Be aware that while the wizard says it's optional, the CLI is easier to use when you supply it here.
Default CPCode to use for your CLI commands. This is optional.
Please input the following information: cpcode: 123456

NetStorage CLI usage examples

You can use the NetStorage CLI once you've installed it and applied your credentials.

akamai netstorage du

<?xml version="1.0" encoding="ISO-8859-1"?>
<du directory="/123456">
 <du-info files="15" bytes="50662"/>
</du>
akamai netstorage list 123456

Getting directory listing
<?xml version="1.0" encoding="ISO-8859-1"?>
<list>
 <file type="dir" name="123456/films/"/>
 <file type="dir" name="123456/movies/"/>
 <file type="file" name="123456/movies/.dotfile" size="0" md5="d41d8cd98f00b204e9800998ecf8427e" mtime="1591383160"/>
 <file type="dir" name="123456/movies/links/"/>
 <file type="symlink" name="123456/movies/links/linkedmovie.mp4"/>
 <file type="symlink" name="123456/movies/links/linkedsubtitle.srt"/>
 <file type="symlink" name="123456/movies/links/movieDirectory"/>
 <file type="file" name="123456/movies/movie.mp4" size="41392" md5="d81f21f9d0ac51621cad3de05ff734c6" mtime="1591745339"/>
 <file type="file" name="123456/movies/movie.zip" size="4180" md5="622c7fe847927e6c0f48d4c317ff1b14" mtime="1628520573"/>
 <file type="file" name="123456/movies/subtitle-test.srt" size="5029" md5="2a80b36db1bbff5a9c1aa0cc61706189" mtime="1604354283"/>
 <file type="dir" name="123456/tv/"/>
 <file type="dir" name="123456/tv/shows/"/>
 <file type="symlink" name="123456/tv/shows/movie.mp4"/>
</list>
akamai netstorage stat movies/movie.zip

Getting stat for file
<?xml version="1.0" encoding="ISO-8859-1"?>
<stat directory="/123456/movies">
 <file type="file" name="movie.zip" mtime="1628520573" size="4180" md5="622c7fe847927e6c0f48d4c317ff1b14"/>
</stat>
akamai netstorage upload movie.mp4
akamai netstorage download movie.mp4
akamai netstorage delete movie.mp4

NetStorage CLI commands

Usage: akamai netstorage <command> <args> [options]                                                         
                                                                                                            
Command options:                                                                                            
  --config <config>    Config file                                                                          
  --section <section>  Section for config file                 [string] [default: default]                  
  --cpcode <cpcode>    CPCode                                                     [string]                  
  --help               Show help                                [commands: help] [boolean]                  
  --version            Show version number                   [commands: version] [boolean]                  
                                                                                                            
System commands:                                                                                            
  setup  Setup authentication for Netstorage                                                                
  du     disk usage stats                                                                                   
                                                                                                            
Directory commands:                                                                                         
  mkdir <directory>         create a new directory                                                          
  rmdir <directory>         delete an empty directory                                                       
  dir [directory]           view a directory structure                                                      
  quick-delete <directory>  recursively delete a directory             Disabled by default                  
  list <directory>          view a directory listing                                                        
                                                                                                            
File commands:                                                                                              
  upload <file>             upload a file                                                                   
  download <file>           download a file                                                                 
  delete <file>             remove a file                                                                   
  rename <file> <location>  rename/move a file                                                              
  symlink <file> <target>   create a symlink                                                                
  mtime <file>              update modification time for a file                                             
  stat <file>               see file information                                                            
                                                                                                            
Copyright (C) Akamai Technologies, Inc