【问题标题】:Cannot copy large (5 Gb) files with awscli 1.5.4无法使用 awscli 1.5.4 复制大 (5 Gb) 文件
【发布时间】:2014-12-31 23:55:20
【问题描述】:

我在使用 aws-cli 时遇到问题,我进行了 yum 更新,它更新了 awscli(除其他外),现在 awscli 在带有 SignatureDoesNotMatch 的大文件(例如 5.1 Gb)上失败。 具有较小文件的完全相同的命令(对同一个存储桶)有效。 如果我使用 python 中的 boto,大文件仍然有效。

它复制除了两个看起来像的所有部分(即,它被计数到 745 个部分中的 743 个),然后出现错误消息。

看起来像 awscli 中的错误? 但是,当我四处搜索时,我找不到任何关于它的信息。

这都是在一个 ec2 实例上执行的。

$ /usr/bin/aws --version
aws-cli/1.5.4 Python/2.6.9 Linux/3.14.20-20.44.amzn1.x86_64

$ ls -hl
-rw-rw-r-- 1 user user      4 Nov  4 21:14 small
-rw-rw-r-- 1 user user 5.1G Nov  4 20:02 big

$ /usr/bin/aws s3 cp small s3://mybucket/uploaded.ext
upload: ./small to s3://mybucket/uploaded.ext

$ /usr/bin/aws s3 cp big s3://mybucket/uploaded.ext
upload failed: ./big to s3://mybucket/uploaded.ext
A client error (SignatureDoesNotMatch) occurred when calling the UploadPart operation: The request signature we calculated does not match the signature you provided. Check your key and signing method.

编辑:以为我找到了,但仍然有这个问题。我宁愿坚持使用 awscli,因为它是我们在整个代码中使用的,而且它比 boto 快得多(至少在它工作时)

Edit2:它实际上变得越来越糟,我可以在控制台中重复相同的复制命令,有时它会通过,有时它不会

【问题讨论】:

    标签: python amazon-web-services amazon-ec2 amazon-s3 aws-cli


    【解决方案1】:

    如果这是 aws-cli 中的错误,我不会感到惊讶。我建议使用 s3cmd 而不是将文件复制到 S3 或从 S3 复制文件并执行所有其他基于 S3 的交互。

    【讨论】:

    • 谢谢。我们曾经在代码中使用 boto,但 awscli 快得多,所以我们改用它。我会看看 s3cmd 看看这是否有意义
    【解决方案2】:

    aws-cli 当然可以处理 5GB 及更高的上传。

    我启动了一个 EC2 实例并能够成功完成它:

    $ /usr/bin/aws --version
    aws-cli/1.3.6 Python/2.6.9 Linux/3.10.35-43.137.amzn1.x86_64
    
    $ dd if=/dev/zero of=small bs=1K count=1
    1+0 records in
    1+0 records out
    1024 bytes (1.0 kB) copied, 0.000388469 s, 2.6 MB/s
    
    $ dd if=/dev/zero of=big bs=5M count=1000
    1000+0 records in
    1000+0 records out
    5242880000 bytes (5.2 GB) copied, 73.733 s, 71.1 MB/s
    
    $ aws s3 mb s3://target77
    make_bucket: s3://target77/
    
    $ aws s3 cp small s3://target77/small
    upload: ./small to s3://target77/small
    
    $ aws s3 cp big s3://target77/big
    upload: ./big to s3://target77/big       
    
    $ aws s3 ls s3://target77/
    2014-11-17 09:44:42 5242880000 big
    2014-11-17 09:44:29       1024 small
    

    到目前为止,一切都很好!

    然后我更新到了新版本的 CLI 并再次尝试:

    $ sudo yum update
    ...
    
    $ /usr/bin/aws --version
    aws-cli/1.5.5 Python/2.6.9 Linux/3.10.35-43.137.amzn1.x86_64
    
    $ aws s3 cp small s3://target77/small
    upload: ./small to s3://target77/small
    
    $ aws s3 cp big s3://target77/big
    upload failed: ./big to s3://target77/bigs) remaining
    A client error (SignatureDoesNotMatch) occurred when calling the UploadPart operation: The request signature we calculated does not match the signature you provided. Check your key and signing method.
    

    我在同一区域和不同区域使用 EC2 实例和 S3 存储桶重复了实验。这两种情况最终都会产生错误,但有时也会起作用。

    所以,更新后的 aws-cli 似乎确实存在问题。另外,当我尝试重新执行复制命令时,错误发生在随机数量的“部分”之后。

    SignatureDoesNotMatch 错误与安全凭证有关,而不是与 Amazon S3 服务有关。这听起来与人们在 GitHub 上报告的问题相似:Recurring SignatureDoesNotMatch client error #995

    所以,我建议使用早期版本的 aws-cli,直到问题得到解决。

    【讨论】:

    • 顺便说一句,aws-cli 是一个调用 boto 的 Python 应用程序。
    • 显然 boto 1.6 对此进行了修复。
    猜你喜欢
    • 2012-05-08
    • 2011-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-15
    • 1970-01-01
    • 2019-02-16
    相关资源
    最近更新 更多