My users are trying to access objects in my Amazon Simple Storage Service (Amazon S3) bucket, but Amazon S3 is returning the HTTP 404 error "NoSuchKey." How can I troubleshoot this error?

Amazon S3 generally returns HTTP 404 errors if the requested object is missing from the bucket, or if the object isn't yet created in the bucket. Before users make GET or HEAD requests for an object, be sure that the object is created and is available in the bucket. To check if an object is available in a bucket, you can review the contents of the bucket from the Amazon S3 console, or you can run the head-object AWS Command Line Interface (AWS CLI) command:

aws s3api head-object --bucket example-bucket --key object.jpg

Note: If a user makes a GET or HEAD request for an object before the object is created, Amazon S3 provides eventual consistency for read-after-write.

If the requested object is available in the bucket and users are still getting the HTTP 404: NoSuchKey error from Amazon S3, check the following:

  • Confirm that the request matches the object name exactly, including the capitalization of the object name. Requests for S3 objects are case sensitive. For example, if an object is named myimage.jpg, but Myimage.jpg is requested, then requester receives an HTTP 404: NoSuchKey error.
  • Confirm that the requested path matches the path to the object. For example, if the path to an object is bucketname/Downloads/February/Images/image.jpg, but the requested path is bucketname/Downloads/February/image.jpg, then the requester receives an HTTP 404: NoSuchKey error.
  • If the path to the object contains any spaces, be sure that the request uses the correct syntax to recognize the path. For example, if you're using the AWS CLI to download an object to your Windows machine, you must use quotation marks around the object path, similar to this: aws s3 cp "s3://example-bucket/Backup Copy Job 4/3T000000.vbk".
  • Optionally, you can enable server access logging to review request records in further detail for issues that might be causing the HTTP 404 error.

Note: If a requested object doesn’t exist in the bucket and the requester doesn’t have s3:ListBucket access, then the requester receives an HTTP 403 Access Denied error rather than an HTTP 404 error. If this is the case, you must resolve the issue related to the missing object to address the HTTP 403 error.  


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2018-07-02