Thursday, December 22, 2022

AWS CLI


Install AWS CLI (Bash)

Terminal
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

Configure AWS CLI

AWS Portal
  • Create IAM user
    • IAM > Users > Add users
      • Define User name
      • Check Access key - Programmatic access
    • Set permissions > Attach existing policies directly
      • Add AdministrarorAccess
    • Security credentials > Create access key
      • Keep Access Key ID and Secret access key
Terminal
  • Configure with command
aws configure

Input the information below
AWS Access Key ID [None]: {ACCESS KEY ID}
AWS Secret Access Key [None]: {SECRET ACCESS KEY}
Default region name [None]: ap-northeast-1
Default output format [None]: json

  • Check configuration
aws configure list

You can see the output like this
      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                <not set>             None    None
access_key     ******************** shared-credentials-file
secret_key     ******************** shared-credentials-file
    region           ap-northeast-1      config-file    ~/.aws/config

  • Check connection (Example command)
aws iam list-users

You can see the output like this
{
    "Users": [
        {
            "Path": "/",
            "UserName": "IAMUSERNAME",
            "UserId": "XXXXXXXXXXXXXXXXX",
            "Arn": "arn:aws:iam::111111111111:user/IAMUSERNAME",
            "CreateDate": "2022-11-14T07:18:27+00:00"
        }
    ]
}








No comments:

Post a Comment