How to set up AWS CLI

1. PIP install

pip install awscli --upgrade --user

2. CREDS

  • Open the following URL
<!-- SYNTAX -->
https://<region>.console.aws.amazon.com/iam/home#/users/<user>?section=security_credentials
<!-- EXAMPLE -->
https://us-east-1.console.aws.amazon.com/iam/home#/users/pavol@gmail.com?section=security_credentials
  1. Give yourself AdministratorAccess permission for the sake of the test
  2. get access key_id
  3. get key

3. CONFIGURE

  • with access key_id and the secret key run
aws configure
  • for output format, chose text (you can enter also json or table)
  • test you have access by listing your s3 buckets
<!-- EXAMPLE OUTPUT -->
2019-06-07 15:41:11 aws-athena-query-results-010101010101-eu-central-1
2020-06-23 19:46:28 aws-athena-query-results-010101010101-eu-west-1
2020-06-30 12:55:49 aws-athena-query-results-010101010101-us-east-1
2020-06-17 17:14:12 aws-athena-query-results-010101010101-us-east-2
2020-06-25 22:26:17 aws-athena-query-results-010101010101-us-west-2

4. AWS PROFILE

  • this will create another profile that can be used
  • you still need account_id and secret key
  • these are added to the config file
aws configure --profile <name>
aws --profile foo2 s3 ls

5. AWS FILES

  • aws stores files in .aws file of the user
▶ cd .aws
~\.aws ⚡ ◷ 10:41:34 AM
▶ dir

Directory: C:\Users\Admin\.aws

Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 7/29/2022 10:35 AM 46 config
-a--- 7/29/2022 10:35 AM 119 credentials

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pavol Kutaj

Pavol Kutaj

Infrastructure Support Engineer/Technical Writer (Snowplow Analytics) with a passion for Python/writing documentation. More about me: https://pavol.kutaj.com