1、 安装awscli
sh
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
ln -s /usr/local/bin/aws /usr/bin/aws
安装完成,检查awscli版本号
aws --version
输出内容
aws-cli/2.15.22 Python/3.11.6 Linux/3.10.0-1160.25.1.el7.x86_64 exe/x86_64.centos.7 prompt/off
2、 配置awscli
配置awscli主要就是提供登录凭证,AWS采用Access Keys的方式
aws configure --profile product
AWS Access Key ID [None]: A**************W
AWS Secret Access Key [None]: M*********************a
Default region name [None]: us-east-2
Default output format [None]: json
配置完后,就会用户home目录下生成.aws目录,里面的文件会记录我们的登录凭证
cat .aws/credentials
[product]
aws_access_key_id = A******************W
aws_secret_access_key = M******************a
[root@localhost ~]# cat .aws/config
[profile product]
region = us-east-2
output = json