System info
- Check Mac OS version
# sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.5
BuildVersion: 18F132
# sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.5
BuildVersion: 18F132
Install the AWS CLI on macOS Using pip
- Check pip3 version
# pip3 --version
-
Install the AWS CLI on macOS Using pip
- Download and install the latest version of Python from the download page of Python.org
-
Download and run the pip3 installation script.
# curl -O https://bootstrap.pypa.io/get-pip.py
# python3 get-pip.py --user
-
Use pip3 to install the AWS CLI.
# pip3 install awscli --upgrade --user
-
Verify that the AWS CLI is installed correctly.
# aws --version
aws-cli/1.16.203 Python/3.7.3 Darwin/18.6.0 botocore/1.12.193
-
To upgrade to the latest version, run the installation command again.
# pip3 install awscli --upgrade --user
-
Add the AWS CLI Executable to Your macOS Command Line Path
-
Find out AWS CLI installation path
# which aws
/Users/nobody/Library/Python/3.7/bin/aws
-
To modify your PATH variable
# echo 'export PATH=/Users/nobody/Library/Python/3.7/bin:$PATH >> ~/.zshrc
-
Load the updated profile into your current session.
# source ~/.zshrc
# pip3 --version
Install the AWS CLI on macOS Using pip
- Download and install the latest version of Python from the download page of Python.org
- Download and run the pip3 installation script.
# curl -O https://bootstrap.pypa.io/get-pip.py # python3 get-pip.py --user
- Use pip3 to install the AWS CLI.
# pip3 install awscli --upgrade --user
- Verify that the AWS CLI is installed correctly.
# aws --version aws-cli/1.16.203 Python/3.7.3 Darwin/18.6.0 botocore/1.12.193
- To upgrade to the latest version, run the installation command again.
# pip3 install awscli --upgrade --user
Add the AWS CLI Executable to Your macOS Command Line Path
- Find out AWS CLI installation path
# which aws /Users/nobody/Library/Python/3.7/bin/aws
- To modify your PATH variable
# echo 'export PATH=/Users/nobody/Library/Python/3.7/bin:$PATH >> ~/.zshrc
- Load the updated profile into your current session.
# source ~/.zshrc
Configuration and Multiple Profiles for AWS
- The aws configure command is the fastest way to set up your AWS CLI installation
# aws configure --profile "Your Name"
AWS Access Key ID [None]: "Your Access Key ID"
AWS Secret Access Key [None]: "Your Secret Access Key"
Default region name [None]: us-east-1
Default output format [None]: table
-
Output format:
- json
- text
- table
-
List
.aws
directory
# tree ~/.aws
/Users/nobody/.aws
├── config
└── credentials
and your can see the config in ~/.aws/config
and ~/.aws/credentials
- Setting environment variable to get AWS config
# export AWS_DEFAULT_PROFILE=nobody
or
# echo 'export AWS_DEFAULT_PROFILE=nobody' >> ~/.zshrc
# source ~/.zshrc
- List aws profiles
# aws configure list --profile nobody
- Get Current Region
# aws configure get nobody.region
- Use
Reference:
# aws configure --profile "Your Name"
AWS Access Key ID [None]: "Your Access Key ID"
AWS Secret Access Key [None]: "Your Secret Access Key"
Default region name [None]: us-east-1
Default output format [None]: table
Output format:
- json
- text
- table
List
.aws
directory# tree ~/.aws
/Users/nobody/.aws
├── config
└── credentials
~/.aws/config
and ~/.aws/credentials
# export AWS_DEFAULT_PROFILE=nobody
# echo 'export AWS_DEFAULT_PROFILE=nobody' >> ~/.zshrc
# source ~/.zshrc
# aws configure list --profile nobody
# aws configure get nobody.region
沒有留言:
張貼留言