CDK Bootstraping

0

Hi AWS, I was setting up a sample application using AWS CDK Python. When I ran the command cdk deploy, I got this error:

current credentials could not be used to assume 'arn:aws:iam::1111111111:role/cdk-hnb659fds-deploy-role-1111111111-us-east-1', but are for the right account. Proceeding anyway.

 ❌ Deployment failed: Error: AwsCdkDemoStack: SSM parameter /cdk-bootstrap/hnb659fds/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
    at Deployments.validateBootstrapStackVersion (C:\Users\amang\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:430:12220)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Deployments.buildSingleAsset (C:\Users\amang\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:430:10985)
    at async Object.buildAsset (C:\Users\amang\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:430:194552)
    at async C:\Users\amang\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:430:178941

AwsCdkDemoStack: SSM parameter /cdk-bootstrap/hnb659fds/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html) 

Following the warning, I ran cdk bootstrap command and I found it created a CloudFormation Stack with AWS defined name CDKToolkit which have these set of AWS Resources as highlighted in the screenshot I attached. CDKToolkit CloudFormation Stack

I want to know if there is a possibility that I could deploy a user-defined CloudFormation Stack resources having user-defined names and also I need to know what are the prerequisites required for the same.

1개 답변
0

You should look into how to either use CLI parameters with the cdk bootstrap command or modify the default bootstrap template and deploy it yourself. This gives you more complete control over the bootstrap resources.

Reference: https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html#bootstrapping-customizing

profile picture
전문가
답변함 한 달 전
profile picture
전문가
검토됨 한 달 전
  • So, I have deleted the CloudFormation Stack which got created when I ran the cdk bootstrap command but the S3 bucket deployed using the template is still present. I tried to delete that manually but the Delete Bucket option is disabled. Why's that?

  • The CloudFormation stack CDKToolkit makes the bucket's DeletePolicy to retain, so that the bucket contents is reserved even after the stack is deleted. This is a best practices for IaC that reserve data source when the stack is deleted. In addition, the s3 bucket can be deleted when there is no object remains. Because the bucket for CDKToolkit is versioning enabled, there will be hidden versioned objects. You can empty the bucket from the S3 console and then can delete the bucket.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠