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 Antwort
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
EXPERTE
beantwortet vor einem Monat
profile picture
EXPERTE
überprüft vor einem Monat
  • 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.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen