- Cheat Sheet and Example is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools









Linux, Mac

# easy_install pip
# pip install awscli
# aws   version
# yum install jq



Configuration of Access Key ID & Secret Access Key

  • Before you command “aws configure”, You must create new user in IAM(Identity & Access Management) for generate “Access Key ID” and “Secret Access Key”.
  • You can command “aws configure” many times.
# aws configure

AWS Access Key ID [None]: youraccesskey  
AWS Secret Access Key [None]: yoursecretkey  
Default region name [None]: ap-northeast-1     # Tokyo
Default output format [None]: json  
$ cat ~/.aws/config
output = json
region = ap-northeast-1

$ cat ~/.aws/credentials 
aws_access_key_id = xxxxxxxxxx
aws_secret_access_key = xxxxxxxxxx

tmp environment

$ export AWS_ACCESS_KEY_ID=xxxxxxxxxx
$ export AWS_SECRET_ACCESS_KEY=xxxxxxxxxx
$ export AWS_DEFAULT_REGION=ap-northeast-1
$ export AWS_DEFAULT_OUTPUT=json

$ aws ec2 describe-instances

other environment

aws configure --profile tmpaws

fill the gap in bash

$ sudo yum install aws-cli-zsh
$ echo 'complete -C aws_completer aws' >>~/.bash_profile
$ source ~/.bash_profile



Description Command
help ec2 option aws ec2 help
List Instance aws ec2 describe-instances
aws ec2 describe-instances --output json
aws ec2 describe-instances --output text
aws ec2 describe-instances --output table
Start Instance aws ec2 start-instances --instance-ids i-AAAA
Stop Instance aws ec2 stop-instances --instance-ids i-AAAAA
Terminate Instance aws ec2 terminate-instances --instance-ids i-AAAA
List a AMI aws ec2 describe-images
List my AMI aws ec2 describe-images --owners self


Description Command
help s3 option aws s3 help
list bucket aws s3 ls
make bucket (mb) aws s3 mb s3://tmpbucket
aws s3 mb s3://mybucket --region us-west-1
remove bucket (rb) aws s3 rb s3://tmpbucket
aws s3 rb s3://tmpbucket --force ← If there is a object in the bucket, you must use “–force” option.
list s3 aws s3 ls s3://tmpbucket/box/
copy to s3 aws s3 cp a.txt s3://tmpbucket
copy to s3 with recursive aws s3 cp TESTDIR s3://tmpbucket/box --recursive
copy to s3 with read permission aws s3 cp a.txt s3://tmpbucket --acl public-read
copy from s3 aws s3 cp s3://tmpbucket/a.txt a.txt
copy from s3 with recursive aws s3 cp s3://tmpbucket/dir dir --recursive
delete a file aws s3 rm s3://tmpbucket/a.txt
delete directory aws s3 rm s3://tmpbucket/box --recursive
rsync aws s3 sync localsync s3://tmpbucket/synctest/
rsync aws s3 sync s3://tmpbucket/synctest/ localsync
rsync aws s3 sync localsync s3://tmpbucket/synctest/ --delete
rsync aws s3 sync localsync s3://tmpbucket/synctest/ --exclude "ignore/*"


Description Command
help elb option aws elb help
Check ELB aws elb describe-instance-health --load-balancer-name ELBTEST
Register instance to LB aws elb register-instances-with-load-balancer --load-balancer-name LBTEST --instances i-AAAAA
Deregister instance from LB aws elb deregister-instances-from-load-balancer --load-balancer-name LBTEST --instances i-AAAAA

dc/aws/cli.html.txt · Last modified: 2018/02/09 by admin

Page Tools