How to set up AWS CLI
The aim of this page📝 is to quickly setup 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
- Make sure you have programmatic access
- Give yourself
AdministratorAccess
permission for the sake of the test - get access key_id
- get key
3. CONFIGURE
- with access key_id and the secret key run
aws configure
- you are prompted for both + default region + output format
- for output format, chose
text
(you can enter alsojson
ortable
) - 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>
- to use another profile use
--profile <name>
with the command, e.g.
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