【问题标题】:An error occurred (404) when calling the HeadObject operation: Key "" does not exist调用 HeadObject 操作时发生错误(404):Key \"\" 不存在
【发布时间】:2022-11-11 02:51:32
【问题描述】:

我正在使用终端将文件从 s3 存储桶复制到本地计算机,但我不断收到错误消息:

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

我正在使用命令:

usr/local/bin/aws s3 cp s3://{bucket}/file_000 /Users/user/Documents/Docs/dir/new_file.csv

我知道该文件存在使用:

aws s3 ls s3://{bucket} --recursive --human-readable

并显示为:

2022-08-04 15:53:12 21.2 MiB file_000

我尝试在命令末尾添加--recursive。该命令通过但随后创建一个名为 new_file.csv 的空目录

我能做些什么来解决这个问题吗?

【问题讨论】:

  • 你是如何列出文件的?
  • 我把它添加到帖子中
  • 尝试使用aws s3api list-objects --bucket example-bucket --query Contents[].Key 来验证没有特殊字符,例如,请注意密钥名称中的尾随空格。
  • 感谢@AnonCoward,这有助于看到我的文件被列为“file_000”。谢谢!

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


【解决方案1】:

我遇到了同样的问题,对我有用的是回到 s3 存储桶并确认存储桶中对象的名称与我的代码内部相同。我意识到事实并非如此,一旦我纠正了这一点并重新运行程序,一切正常。

【讨论】:

    猜你喜欢
    • 2021-09-03
    • 2017-12-07
    • 2018-03-20
    • 2020-09-14
    • 2020-06-07
    • 1970-01-01
    • 2022-01-08
    • 2021-05-06
    • 2022-08-11
    相关资源
    最近更新 更多