Linux 使用亚马逊AWS 命令行界面 (CLI)

目录

AWS 命令行界面 (CLI) 官方文档

1.Linux 平台安装 AWS CLI

2.Linux 配置 AWS CLI

3.Linux 使用AWS-CLI下载亚马逊 S3的多个目标


AWS 命令行界面 (CLI) 官方文档

What is the AWS Command Line Interface? - AWS Command Line Interface

1.Linux 平台安装 AWS CLI

#下载安装文件
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
#解压安装文件
unzip awscliv2.zip


#默认安装路径
/home/xxx/Tools/AWS_CLI/2023.11
#指定安装路径
./aws/install -i /home/xxx/Tools/AWS_CLI/2023.11  -b /home/xxx/Tools/AWS_CLI/2023.11

##--install-dir or -i – This option specifies the directory to copy all of the files to.
##--bin-dir or -b – This option specifies that the main aws program in the install directory is symbolically linked to the file aws in the specified path. 
## You must have write permissions to the specified directory. 
## Creating a symlink to a directory that is already in your path eliminates the need to add the install directory to the user's $PATH variable.

2.Linux 配置 AWS CLI

#在安装路径下进行配置
./aws configure
#配置完成后,可知/home/.aws/目录下查看配置文件

注意事项:

配置时,需创建用户

3.Linux 使用AWS-CLI下载亚马逊 S3的多个目标

What is Amazon S3? - Amazon Simple Storage Service

The following example shows how you can use the AWS CLI to download all of the files or objects under the specified directory or prefix. This command copies all objects from the bucket DOC-EXAMPLE-BUCKET1 to your current directory. To use this example command, use your bucket name in place of DOC-EXAMPLE-BUCKET1.

aws s3 cp s3://DOC-EXAMPLE-BUCKET1 . --recursive

The following command downloads all of the objects under the prefix logs in the bucket DOC-EXAMPLE-BUCKET1 to your current directory. It also uses the --exclude and --include parameters to copy only objects with the suffix .log. To use this example command, replace the user input placeholders with your own information.

注意事项:Use of Exclude and Include Filters 

s3 — AWS CLI 2.13.34 Command Reference

#使用AWS-CLI下载多个目标
aws s3 cp s3://DOC-EXAMPLE-BUCKET1/logs/ . --recursive --exclude "*" --include "*.log"

#AWS CLI Access (No AWS account required)
aws s3 cp --no-sign-request s3://DOC-EXAMPLE-BUCKET1/logs/ . --recursive --exclude "*" --include "*.log"

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值