Config AWS CLI

234 阅读1分钟

Install AWS CLI

For windows platform, it's very easy! Download a msi file first, then install follow the wizard docs.aws.amazon.com/zh_cn/cli/l… Once completed, you can open cmd tool, and type aws --version to verify

Create IAM user

Since aws cli is installed already, it's time to config. Please note, it's NOT recommended to config for root user, so please create a IAM user first. if you don't have IAM account, please contact administrator to create one, if you have root account, you can create a IAM accout follow this guide, it's quite easy! docs.aws.amazon.com/IAM/latest/…

Create access key for IAM user

Since the IAM account is ready, let's create an access key now

Step:

  1. Logon as IAM user
  2. open IAM console link: console.aws.amazon.com/iam/home#/h…
  3. Select user on the left menu and click user name you want to creat access key
  4. Select "Security credentials" tab, and click "Create Access Key"
  5. Keep above access key ID and access key in local, since we only have one opportunity to see these information on aws portal
  6. open commond line tool, then type aws configure, it will raise some below option, then type the value you just created:
$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]: json

Post check

Through above steps, we can install and configur cli successfully, now we can verify if we can interact with aws services via cli. we can try to create a s3 bucket as verification

create a s3 buckekt via cli

type below command to create a s3 bucket:

$ aws s3 mb s3://a-valid-bucket-name

if everything goes well, you can create the s3 bucket

Further reading

For details of cli command and other resources, please refer to official link here : docs.aws.amazon.com/cli/latest/…