amazon-web-services - AWS CLI S3 : copying file locally using the terminal : fatal error: An error occurred (404) when calling the HeadObject operation

标签 amazon-web-services amazon-s3 aws-sdk aws-cli aws-cloudformation

我正在尝试从 s3 存储桶本地复制文件。我可以获得我的存储桶中的文件列表:

aws s3 ls  s3://myBucket/myDirectory/todaysFiles/

但是当我尝试在本地复制文件时:

aws s3 cp s3://myBucket/myDirectory/todaysFiles/ .

我收到此错误:

fatal error: An error occurred (404) when calling the HeadObject operation: Key "myDirectory/todaysFiles/" does not exist

但我尝试在本地仅复制一个文件:

 aws s3 cp s3://myBucket/myDirectory/todaysFiles/somefile .

我收到此错误:

 warning: Skipping file s3://myBucket/myDirectory/todaysFiles/somefile. Object is of storage class GLACIER. Unable to perform download operations on GLACIER objects. You must restore the object to be able to the perform operation. See aws s3 download help for additional parameter options to ignore or force these transfers.

你们中有人知道我为什么会收到此错误或解决此错误的方法吗?

非常感谢您的帮助

最佳答案

对于第一个错误 - 添加递归标志:

aws s3 cp s3://myBucket/myDirectory/todaysFiles/ . --recursive

这会将“todaysFiles”目录中的所有文件复制到当前目录。

但是,第二个错误表明您的文件位于 Glacier 中。这让事情变得有点复杂,因为 Glacier 不是实时的 - 取决于您愿意支付的费用,数据可能需要几个小时才能恢复。请参阅Restoring Objects文档以获取更多信息。在对象从 Glacier 恢复到 S3 之前,您无法从 S3 进行复制。

请注意,如果您这样做,您将需要承担来自 Glacier 和 S3 的费用。

顺便说一句,如果这些文件确实是今天的文件,那么存储在 S3 上和推送到 Glacier 之间应该有更长的时间。但我猜测父目录也可能有一个与日期相关的组件。

关于amazon-web-services - AWS CLI S3 : copying file locally using the terminal : fatal error: An error occurred (404) when calling the HeadObject operation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45109533/

相关文章:

android - 如何阻止连接到 AWS RDS 实例的不需要的设备?

amazon-web-services - 如何存储托管在 Ubuntu 16.04 上的 dotnet 核心应用程序的 AWS 凭证?

php - 如何授予多个用户访问单个 Amazon S3 账户的权限并确定谁添加了文件?

.htaccess - CORS问题请求的资源上不存在 'Access-Control-Allow-Origin' header

amazon-web-services - AWS Cloudwatch警报将参数传递给另一个参数

amazon-web-services - AWS Lambda - 在认知用户池中搜索用户

javascript - 如何使用 Node 在AWS上保存图像

node.js - 从 nodejs 请求到 s3 的流式响应

node.js - 如何在 AWS Lambda 中使用加密的环境变量?

java - 通过 Java SDK 与 Lambda 函数进行 AWS api 网关集成,必须为 AWS 集成异常指定角色 ARN