leapp: Cannot run cdk bootstrap when using Leapp to manage AWS credentials

Describe the bug

I have a CDK stack that I want to deploy into a new AWS account. I have set up this account in Leapp, and I can confirm that I have the right level of access. When I try and bootstrap CDK into this account I get the following error:

cdk bootstrap aws://xxxxxxx/eu-west-1

The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 81edc5fe-46db-47d3-83c4-de06d32eeaf3; Proxy: null)

Leapp Version

Version 0.18.1 (Core: 0.1.139)

To Reproduce

Got an an AWS region where CDK has not been bootstrapped Run the following command:

cdk bootstrap aws://{aws-account}/{aws-region}

Expected behavior It should complete the CDK bootstrap process.

Screenshots This is the output from my terminal:

 ⏳  Bootstrapping environment aws://xxxxxx/eu-west-1...
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.
CDKToolkit: creating CloudFormation changeset...
4:57:57 PM | CREATE_FAILED        | AWS::IAM::Role          | CloudFormationExecutionRole
The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 865c68a5-62eb-4
83d-815a-17c35f946fbc; Proxy: null)

4:57:57 PM | CREATE_FAILED        | AWS::IAM::Role          | LookupRole
The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 7b083eaa-0214-4
9e8-a288-ce8c37a10ac9; Proxy: null)

4:57:57 PM | CREATE_FAILED        | AWS::IAM::Role          | ImagePublishingRole
The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 81edc5fe-46db-4
7d3-83c4-de06d32eeaf3; Proxy: null)

4:57:57 PM | CREATE_FAILED        | AWS::IAM::Role          | FilePublishingRole
The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 4ff6cd58-6c57-4
bc7-b55f-523801d7cf4e; Proxy: null)

 ❌  Environment aws://665240076514/eu-west-1 failed bootstrapping: Error: The stack named CDKToolkit failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 865c68a5-62eb-483d-815a-17c35f946fbc; Proxy: null), The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 7b083eaa-0214-49e8-a288-ce8c37a10ac9; Proxy: null), The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 81edc5fe-46db-47d3-83c4-de06d32eeaf3; Proxy: null), The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 4ff6cd58-6c57-4bc7-b55f-523801d7cf4e; Proxy: null)
    at FullCloudFormationDeployment.monitorDeployment (/Users/ricsue/.nvm/versions/node/v18.15.0/lib/node_modules/aws-cdk/lib/index.js:412:10236)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/ricsue/.nvm/versions/node/v18.15.0/lib/node_modules/aws-cdk/lib/index.js:417:2104
    at async Promise.all (index 0)
    at async CdkToolkit.bootstrap (/Users/ricsue/.nvm/versions/node/v18.15.0/lib/node_modules/aws-cdk/lib/index.js:417:1949)
    at async exec4 (/Users/ricsue/.nvm/versions/node/v18.15.0/lib/node_modules/aws-cdk/lib/index.js:470:52002)

The stack named CDKToolkit failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 865c68a5-62eb-483d-815a-17c35f946fbc; Proxy: null), The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 7b083eaa-0214-49e8-a288-ce8c37a10ac9; Proxy: null), The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 81edc5fe-46db-47d3-83c4-de06d32eeaf3; Proxy: null), The security token included in the request is invalid (Service: AmazonIdentityManagement; Status Code: 403; Error Code: InvalidClientTokenId; Request ID: 4ff6cd58-6c57-4bc7-b55f-523801d7cf4e; Proxy: null)

Desktop (please complete the following information):

  • OS: MacOS
  • OS Version Ventura 3.4.1 (22F82)
  • Leapp Version Version 0.18.1 (Core: 0.1.139)

Additional context To resolve the issue, I created (manually) a new IAM user and AWS credentials. I stopped all my Leapp sessions. I then created a new .aws/credentials file and added this new AWS credentials. I was then able to successfully bootstrap CDK.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

I was referring to this exact process. I don’t know what’s going wrong since I usually fixed CDK problems this way; I summon @ericvilla maybe he can be of help.