[Fix] Added a step to bootstrap cdk template into AWS account#1
[Fix] Added a step to bootstrap cdk template into AWS account#1pedropnaves wants to merge 1 commit into
Conversation
arthurribeirozup
left a comment
There was a problem hiding this comment.
The PR looks good. I have only one question.
| @@ -1,3 +1,4 @@ | |||
| cd infra | |||
| npm install | |||
| npx cdk bootstrap | |||
There was a problem hiding this comment.
Looks good, I have one question. Which aws account/region will this bootstrap happen? I'm thinking it will happen on the default account on the user computer, but I'm not sure. I've taken a look at the docs and I think it will be necessary to use the stage info in this command.
cdk bootstrap aws://ACCOUNT-NUMBER-1/REGION-1
There was a problem hiding this comment.
You are correct.
When we run the bootstrap command, it uses these variables to deploy the CDK stack into the cloud formation in the region provided by the AWS_DEFAULT_REGION environment variable.
The problem is that the bootstrap command doesn't have a good way to override/extends the configurations as we do in /bin/infra.ts
I have only seen one way passing the --profile parameter, but it would take more configuration to create these profiles.
What do you think? Do you see any way to pass these variables dynamically to the bootstrap command?
I tried to follow the StackSpot deploy-aws documentation to deploy an example of React application but an error was generated.
Error stack (I replaced my AWS AccountId from logs to 000000000000):
OS:
Following the aws cdk documentation, was necessary to run the CDK
bootstrapcommand before CDKdeploycommand.I did this and the deployment was successful
and after that the
stk deploycommand runs smoothlySo, I changed the infra template to run CDK bootstrap command before CDK deploy command.
PS: I think that is not a problem to run CDK bootstrap multiple times, CDK knows how to manage that and skip if doesn't have any changes.