zyu911

亚马逊S3数据迁移到中国区

最近有个需求是要把亚马逊亚太区的数据复制到中国区, 但亚马逊中国区不能使用跨区复制.
好在数据量不是很大目前能想到的法子是批量下载下来, 再批量上传到中国区.
使用亚马逊提供的cli工具

  • MAC下安装工具:
    brew install awscli
    
  • 配置
    aws configure
    

    输入相应的key, secret_key, region, Default output format 为空.
  • 测试下是否设置成功
    aws s3 ls s3://桶名/
    
  • 批量下载文件:
    aws s3 cp s3://桶名/ /本地/下载/目录/ -- recursive [--region us-west-2]
    
  • 批量上传文件:
    aws s3 cp /本地/本地/目录/ s3://桶名 -- recursive [--region us-west-2]
    
    现在等待完成就可以了

CLI关于S3的其它命令

  • 查看: aws s3 ls s3://bucket/prefix/
  • 递归删除桶的所有内容: aws s3 rb s3://bucket-name --force
  • 显示桶的大小和文件数: aws s3api list-objects --bucket BUCKETNAME --output json --query "[sum(Contents[].Size), length(Contents[])]"
  • 移动桶: aws s3 sync s3://oldbucket s3://newbucket --source-region us-west-1 --region us-west-2

分类:

技术点:

相关文章:

  • 2021-10-11
  • 2021-12-26
  • 2022-12-23
  • 2021-04-24
  • 2021-04-14
  • 2021-08-20
  • 2021-11-10
  • 2021-05-22
猜你喜欢
  • 2022-12-23
  • 2021-03-28
  • 2021-10-10
  • 2022-12-23
  • 2021-08-09
  • 2022-01-28
  • 2021-12-29
相关资源
相似解决方案