【问题标题】:Use AWS CLI to Copy from S3 to EC2使用 AWS CLI 从 S3 复制到 EC2
【发布时间】:2014-04-16 23:37:26
【问题描述】:

我已将文件压缩到 S3 存储桶中,我需要将其带回我的 EC2 实例。过去,我使用以下命令将文档移动到 S3:

aws s3 cp /my/ec2/path/ s3://my/s3/path/ --exclude '*' --include '2014-01*’ —-recursive

要将 2014 年 1 月的文件移回 EC2,我尝试了以下命令:

aws s3 cp s3://my/s3/path/ //my/ec2/path/ --exclude '*' --include '2014-01*' --recursive

我的理解是,此命令会排除所有文件,但会包含所有前缀为“2014-01”的文件。我已经确认这就是我想要的文件的开始方式。我还尝试了在 mainstorage 之前只使用一个正斜杠并包含更少的文件。

我已经关注了亚马逊的这两个链接:

【问题讨论】:

    标签: amazon-web-services amazon-ec2 amazon-s3 command-line-interface


    【解决方案1】:

    想通了。关键是在 --include 中定义文件路径,即 --include '2014-1'。正确的命令:

    aws s3 cp s3://my/s3/path //my/ec2/path/ --exclude '*' --include '*2014-01*' --recursive
    

    【讨论】:

      猜你喜欢
      • 2019-01-02
      • 2017-02-04
      • 2019-04-13
      • 2019-04-01
      • 1970-01-01
      • 2018-02-10
      • 1970-01-01
      • 2018-04-02
      • 2022-01-24
      相关资源
      最近更新 更多