Note: for support questions, please first reference our documentation, then use Stackoverflow. This repository's issues are intended for feature requests and bug reports.
I'm submitting a ...
What is the current behavior?
If the current behavior is a :beetle:bug:beetle:: Please provide the steps to reproduce
Running cdk deploy against a stack with a custom resource:
<stack name> failed: Error: This stack uses assets, so the toolkit stack must be deployed to the environment (Run "cdk bootstrap aws://123456789012/us-east-1")
This stack uses assets, so the toolkit stack must be deployed to the environment (Run "cdk bootstrap aws://123456789012/us-east-1")
Following the instructions and running cdk bootstrap aws://123456789012/us-east-1
results in:
Expected environment name in format '<account>/<region>', got: aws://123456789012/us-east-1
Error gives sample cdk bootstrap command in expected format.
Useful error message
Please tell us about your environment:
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)
Thanks, @clareliguori
I got similar error when run cdk deploy
, but with unknown-account/unknown-region
Error: This stack uses assets, so the toolkit stack must be deployed to the environment (Run "cdk bootstrap aws://unknown-account/unknown-region")
After read your notes, I now know how to run cdk bootstrap
. There are not enough documents for us to get help in its README
$ cdk bootstrap aws://1234/ap-southeast-2
⏳ Bootstrapping environment aws://1234/ap-southeast-2...
CDKToolkit: creating CloudFormation changeset...
0/2 | 11:47:23 PM | CREATE_IN_PROGRESS | AWS::S3::Bucket | StagingBucket
0/2 | 11:47:24 PM | CREATE_IN_PROGRESS | AWS::S3::Bucket | StagingBucket Resource creation Initiated
1/2 | 11:47:46 PM | CREATE_COMPLETE | AWS::S3::Bucket | StagingBucket
2/2 | 11:47:48 PM | CREATE_COMPLETE | AWS::CloudFormation::Stack | CDKToolkit
✅ Environment aws://1234/ap-southeast-2 bootstrapped.
The bootstrap
, in fact, creates another cloudformation stack to manage the s3 bucket for lambda assets (zip files)
After that, I can run cdk deploy
successfully
I encountered the same issue. I think the error message is fine but it makes it seem like the AWS account and region are not configured even when they are.
I would just update the error message, if anything.
It informs the user how to fix, namely cdk bootstrap
(using named profiles if that is why it appears as unknown in the msg)
@vegetabill what would a more helpful message look like. Fix the command to just Run cdk bootstrap
and link to it's documentation?
@Jerry-AWS - This is probably also an opportunity for us to improve the documentation around bootstrap, what it does, why it's necessary and how the CDK uses it. The documentation likely hasn't been touched in a long time.
@shivlaks I have a bit on bootstrap in the new troubleshooting topic I'm working on, but I should add it to the Getting Started topic as well. (Even though the example used in Getting Started doesn't need the bootstrap.)
realized this was already addressed through #3599
You can also do cdk bootstrap --profile [aws profile name]
if you have stored your credentials under the ~/.aws
folder.
For the benefit of whoever else finds this, I came across this issue from the "imageScanOnPush" parameter of ecr.Repository
Most helpful comment
Thanks, @clareliguori
I got similar error when run
cdk deploy
, but withunknown-account/unknown-region
After read your notes, I now know how to run
cdk bootstrap
. There are not enough documents for us to get help in its READMEThe
bootstrap
, in fact, creates another cloudformation stack to manage the s3 bucket for lambda assets (zip files)After that, I can run
cdk deploy
successfully