aws: command line interface

The post discusses AWS command line interface.


bash-3.2$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.11.6
BuildVersion:   15G1510
bash-3.2$ python --version
Python 2.7.10
bash-3.2$ pip --version
pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)

api and aws
The AWS service behaviours is controlled by API. Here shows using AWS CLI to control AWS service.

install aws cli
Use pip, python package manager, to install awscli package

bash-3.2$ sudo pip install --upgrade awscli --ignore-installed six
The directory '/Users/chengyihe/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/chengyihe/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting awscli
  Downloading awscli-1.11.127-py2.py3-none-any.whl (1.2MB)
    100% |████████████████████████████████| 1.2MB 746kB/s 
Collecting six
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting docutils>=0.10 (from awscli)
  Downloading docutils-0.13.1-py2-none-any.whl (537kB)
    100% |████████████████████████████████| 542kB 818kB/s 
Collecting botocore==1.5.90 (from awscli)
  Downloading botocore-1.5.90-py2.py3-none-any.whl (3.6MB)
    100% |████████████████████████████████| 3.6MB 325kB/s 
Collecting s3transfer<0.2.0,>=0.1.9 (from awscli)
  Downloading s3transfer-0.1.10-py2.py3-none-any.whl (54kB)
    100% |████████████████████████████████| 61kB 1.4MB/s 
Collecting colorama<=0.3.7,>=0.2.5 (from awscli)
  Downloading colorama-0.3.7-py2.py3-none-any.whl
Collecting PyYAML<=3.12,>=3.10 (from awscli)
  Downloading PyYAML-3.12.tar.gz (253kB)
    100% |████████████████████████████████| 256kB 1.4MB/s 
Collecting rsa<=3.5.0,>=3.1.2 (from awscli)
  Downloading rsa-3.4.2-py2.py3-none-any.whl (46kB)
    100% |████████████████████████████████| 51kB 593kB/s 
Collecting python-dateutil<3.0.0,>=2.1 (from botocore==1.5.90->awscli)
  Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 877kB/s 
Collecting jmespath<1.0.0,>=0.7.1 (from botocore==1.5.90->awscli)
  Downloading jmespath-0.9.3-py2.py3-none-any.whl
Collecting futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" (from s3transfer<0.2.0,>=0.1.9->awscli)
  Downloading futures-3.1.1-py2-none-any.whl
Collecting pyasn1>=0.1.3 (from rsa<=3.5.0,>=3.1.2->awscli)
  Downloading pyasn1-0.3.1-py2.py3-none-any.whl (61kB)
    100% |████████████████████████████████| 71kB 925kB/s 
Installing collected packages: docutils, six, python-dateutil, jmespath, botocore, futures, s3transfer, colorama, PyYAML, pyasn1, rsa, awscli
  Running install for PyYAML ... done
Successfully installed PyYAML-3.12 awscli-1.11.127 botocore-1.5.90 colorama-0.3.7 docutils-0.13.1 futures-3.1.1 jmespath-0.9.3 pyasn1-0.3.1 python-dateutil-2.6.1 rsa-3.4.2 s3transfer-0.1.10 six-1.10.0
bash-3.2$ aws --version
aws-cli/1.11.127 Python/2.7.10 Darwin/15.6.0 botocore/1.5.90

aws usage
The aws command can send client api all AWS service. For example EC2 and S3.

bash-3.2$ aws
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: too few arguments

show aws s3 document

bash-3.2$ aws s3 help

show aws ec2 document

bash-3.2$ aws ec2 help

The post discusses how to install AWS CLI, and shows its usage.

AWS Command Line Interface
Universal Command Line Environment for AWS.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: