Skip to content

ran cdk bootstrap aws://956394424627/us-east-2 successfully but deploy says BootstrapNotDetectedError: This AWS account and region has not been bootstrapped.

0

I get this build error on my amplify app BootstrapNotDetectedError: This AWS account and region has not been bootstrapped.

Even after successfully executing this:

C:\Users\Denise>cdk bootstrap aws://956394424627/us-east-2 ⏳ Bootstrapping environment aws://956394424627/us-east-2... Trusted accounts for deployment: (none) Trusted accounts for lookup: (none) Using default execution policy of 'arn:aws:iam::aws:policy/AdministratorAccess'. Pass '--cloudformation-execution-policies' to customize. ✅ Environment aws://956394424627/us-east-2 bootstrapped (no changes).

2 Answers
0
Accepted Answer

Confirm whether CDK bootstrap worked correctly in the region you are using Amplify. To do so, you can login to account, go to CloudFormation console in the correct region and look for a stack CDKToolkit. If it's there CDK has been bootstrapped.

EXPERT

answered a year ago

EXPERT

reviewed a year ago

0

This issue occurs when your AWS account and region have been bootstrapped, but the CDK or Amplify deployment process is still unable to detect the bootstrap resources. There are a few potential causes and solutions:

  1. Region Mismatch: You bootstrapped us-east-2, but your application might be trying to deploy to a different region. Make sure the region in your deployment command matches the bootstrapped region.

  2. Environment Variables: Set the AWS_REGION or AWS_DEFAULT_REGION environment variable to ensure your deployment targets the correct region:

set AWS_DEFAULT_REGION=us-east-2
  1. Hard-coded Region in Code: Your application code might have a hard-coded region that differs from the one you bootstrapped. Check your app configuration files.

  2. CDK New Style Bootstrapping: Ensure you're using the new style of CDK bootstrapping by setting the environment variable:

set CDK_NEW_BOOTSTRAP=1

Then run the bootstrap command again.

  1. Amplify Specific Issue: If you're using Amplify, try running:
npx aws-cdk@latest bootstrap aws://956394424627/us-east-2
  1. Permissions: Verify that the IAM user or role you're using has the necessary permissions to access the bootstrap resources.

  2. Synth Lock Issue: If there's a stale synth lock, look for a file called "cdk.out/synth.lock" and remove it if no other synth process is running.

After making these changes, try your deployment again. If the issue persists, you might need to check CloudTrail logs for any denied API calls related to accessing the bootstrap resources.
Sources
Encountering an issue while setting up my Amplify Data backend | AWS re:Post
Register multiple AWS accounts with a single email address by using Amazon SES - AWS Prescriptive Guidance
Deployment - Verifiable Controls Evidence Store
CDK Bootstrapping Issue | AWS re:Post

answered a year ago

AWS
SUPPORT ENGINEER

reviewed a year ago

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.