编程语言/S3:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第70行: 第70行:
pip3 install awscli --ignore-installed six</syntaxhighlight>|<syntaxhighlight lang="bash">
pip3 install awscli --ignore-installed six</syntaxhighlight>|<syntaxhighlight lang="bash">
</syntaxhighlight>|$|/home/kangkk}}
</syntaxhighlight>|$|/home/kangkk}}
: 如果失败,则手动配置路径,
: {{Hc|~/.local/.bashprofile|<syntaxhighlight lang="javascript">
export PATH=~/.local/bin:$PATH</syntaxhighlight>}}

2022年2月4日 (五) 12:04的版本

引言

aws

[jian@kang /home/kangkk]$
pip3 install --upgrade pip && pip3 install awscli awscli-plugin-endpoint && aws --version
aws-cli/1.22.26 Python/3.9.9 Darwin/19.6.0 botocore/1.23.26

配置文件

执行命令进行配置文件的创建。

/home/kangkk
aws configure

或者也可以手动创建配置文件到目标文件夹 ~/.aws。

/home/kangkk
mkdir ~/.aws

然后编写配置文件。

config
[plugins]
endpoint = awscli_plugin_endpoint

[default]
region = us-east-1
output = json
s3 =
  endpoint_url = http://xxx.xyz
  signature_version = s3v4
s3api =
  endpoint_url = http://xxx.xyz

和

credentials
[default]
aws_access_key_id=abcdefg
aws_secret_access_key=1234567890

[pub-bjyt-s3]
aws_access_key_id=abcdefg
aws_secret_access_key=1234567890

命令

删除

删除文件夹

/home/kangkk
aws s3 rm s3://bucket_name/folder --recursive
recursive: 递归

上传

/home/kangkk
aws s3 cp /home/kangkk/folder_name/file.zip s3://bucket_name/folder/

下载

/home/kangkk
aws s3 cp s3://bucket_name/folder/ /home/kangkk/folder_name --recursive

备份

迁移/备份 bucket 的内容到另一个 bucket。

/home/kangkk
aws s3 sync s3://bucket_source_name s3://bucket_target_name

迁移

/home/kangkk
aws s3 mv s3://bucket_source_name s3://bucket_target_name

s3cmd

上传

转存

error

  • bash: aws: command not found
同时安装 python2 和 python3,导致冲突。修复冲突。
[jian@kang /home/kangkk]$
pip3 install awscli --ignore-installed six
如果失败,则手动配置路径,
~/.local/.bashprofile
export PATH=~/.local/bin:$PATH