Skip to content

Need to perform AWS calls for account <account-number>, but no credentials have been configured #32357

@zhaojiew10

Description

@zhaojiew10

Describe the bug

Error occur when run cdk bootstrap. Need to perform AWS calls for account , but no credentials have been configured

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

2.166.0

Expected Behavior

bootstrap output

$ cdk --version
2.166.0 (build 7bb9203)

$ cdk bootstrap aws://xxxxxxxx/cn-north-1 --profile testcdkgroup --region cn-north-1
 ⏳  Bootstrapping environment aws://xxxxxxxxx/cn-north-1...
Trusted accounts for deployment: (none)
Trusted accounts for lookup: (none)
Using default execution policy of 'arn:aws-cn:iam::aws:policy/AdministratorAccess'. Pass '--cloudformation-execution-policies' to customize.
CDKToolkit: creating CloudFormation changeset...

Current Behavior

bootstrap error

$ cdk bootstrap aws://xxxxxxxxx/cn-north-1 --profile testcdkgroup --region cn-north-1
 ⏳  Bootstrapping environment aws://xxxxxxxxx/cn-north-1...
(Use `node --trace-warnings ...` to show where the warning was created)
 ❌  Environment aws://xxxxxxxxx/cn-north-1 failed bootstrapping: Error: Need to perform AWS calls for account xxxxxxxxx, but no credentials have been configured
    at SdkProvider.forEnvironment (/opt/software/node16/lib/node_modules/aws-cdk/lib/index.js:764:18100)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Function.lookup (/opt/software/node16/lib/node_modules/aws-cdk/lib/index.js:614:8583)
    at async Bootstrapper.modernBootstrap (/opt/software/node16/lib/node_modules/aws-cdk/lib/index.js:615:1084)
    at async /opt/software/node16/lib/node_modules/aws-cdk/lib/index.js:821:1671
Need to perform AWS calls for account xxxxxxxxx, but no credentials have been configure

Reproduction Steps

$ cdk --version
2.167.0 (build 677e108)

when run bootstrap command meet following error

cdk bootstrap aws://xxxxxxxxx/cn-north-1 --profile testcdkgroup --region cn-north-1

the aws config is

[profile testcdkgroup]
role_arn       = arn:aws-cn:iam::xxxxxxxxx:role/rolename
source_profile = admin
region=cn-north-1

I could get credential

$ aws sts get-caller-identity --profile testcdkgroup --region cn-north-1
{
    "UserId": "AROAWN7K6YMQG3NB37S32:botocore-session-1733147811",
    "Account": "xxxxxxxxx",
    "Arn": "arn:aws-cn:sts::xxxxxxxxxx:assumed-role/rolename/botocore-session-1733147811"
}

bootstrap output

$ cdk bootstrap aws://xxxxxxxxx/cn-north-1 --profile testcdkgroup --region cn-north-1
 ⏳  Bootstrapping environment aws://xxxxxxxxx/cn-north-1...
(Use `node --trace-warnings ...` to show where the warning was created)
 ❌  Environment aws://xxxxxxxxx/cn-north-1 failed bootstrapping: Error: Need to perform AWS calls for account xxxxxxxxx, but no credentials have been configured
    at SdkProvider.forEnvironment (/opt/software/node16/lib/node_modules/aws-cdk/lib/index.js:764:18100)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Function.lookup (/opt/software/node16/lib/node_modules/aws-cdk/lib/index.js:614:8583)
    at async Bootstrapper.modernBootstrap (/opt/software/node16/lib/node_modules/aws-cdk/lib/index.js:615:1084)
    at async /opt/software/node16/lib/node_modules/aws-cdk/lib/index.js:821:1671
Need to perform AWS calls for account xxxxxxxxx, but no credentials have been configure

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.167.0+

Framework Version

No response

Node.js Version

Node.js 16.x

OS

amazonlinux 2

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.effort/smallSmall work item – less than a day of effortp0package/toolsRelated to AWS CDK Tools or CLI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions