Facing NoSuchKey exception when deploying a stack


Exception when creating a new stack in new region -

Resource handler returned message: "Error occurred while GetObject. S3 Error Code: NoSuchKey. S3 Error Message: The specified key does not exist. (Service: Lambda, Status Code: 400, Request ID: 0cacb1d8-4d8b-42d3-902f-69f3f00714ab)" (RequestToken: 0c41853d-9b32-736a-9b09-105020d47e8e, HandlerErrorCode: InvalidRequest)
asked 10 days ago130 views
2 Answers


What specific CloudFormation template are you using?

Generally, the cause of this error is that the S3 path specification is incorrect or the specified object does not exist in the S3 bucket.
So please make sure that the path is correct and that the object is successfully placed in the S3 bucket.

profile picture
answered 10 days ago
profile pictureAWS
reviewed 10 days ago
  • Is there a way to find which bucket is causing this issue?

  • Is it listed or not listed as a parameter in the CloudFormation template you are using? If you share the CloudFormation template you are using, I can check it as well.

  • Could the issue be because "deploymentbucket-" is empty? How do we deploy assets this with CDKBuild-4?

  • What does "CDKBuild-4" mean? If you are creating it using CDK etc., could you share the code on GitHub etc.?



A standard bucket is accessible in only the region in which it was created. So, you'll have an error like NoSuchKey when you access it from your new region.

2 solutions:

  1. for data locality, you replicate your bucket under a different name in the new region (region name as suffix) and you install automatic replication across the buckets
  2. you make the single bucket accessible over a global bucket access point: see https://medium.com/cloudzone/aws-s3-multi-region-access-point-simplify-your-data-access-across-regions-60a232957084 for a good intro. Then go to AWS doc: https://aws.amazon.com/s3/features/multi-region-access-points/

Both solutions above will require changes to your CFN template: you'll have to make the name of the bucket region-dependent (using a CFN Map) or replace current bucket name by global access endpoint



profile pictureAWS
answered 10 days ago
  • Could the issue be because "deploymentbucket-" is empty? How do we deploy assets this with CDKBuild-4?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions

Relevant content