【AWS】AWS CLI 使用

Posted by 西维蜀黍 on 2020-05-05, Last Modified on 2022-07-08

Install AWS CLI V2

$ curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
$ sudo installer -pkg AWSCLIV2.pkg -target /

Verify the installation

To verify that the shell can find and run the aws command in your $PATH, use the following commands.

$ which aws
/usr/local/bin/aws 
$ aws --version
aws-cli/2.0.36 Python/3.7.4 Darwin/18.7.0 botocore/2.0.0

Config

Configure the AWS CLI by running the following command:

aws configure

Enter your Access Keys (Access Key ID and Secret Access Key).

To create an access key when signed in as the root user

  1. Sign in to the AWS Management Console as the root user. For more information, see Sign in as the root user in the IAM User Guide.
  2. In the navigation bar on the upper right, choose your account name or number and then choose My Security Credentials.
  3. Expand the Access keys (access key ID and secret access key) section.
  4. Choose Create New Access Key. If you already have two access keys, this button is disabled.
  5. When prompted, choose Show Access Key or Download Key File. This is your only opportunity to save your secret access key.
  6. After you’ve saved your secret access key in a secure location, chose Close.

Reference