aws-cdk-local: Error: Need to perform AWS calls for account 000, but no credentials have been configured

Error running cdklocal bootstrap & deploy

Environment aws://000/us-west-2 failed bootstrapping: Error: Need to perform AWS calls for account 000, but no credentials have been configured

I am running localstack start in one powershell and cdklocal bootstrap/deploy in another. I also tried once with localstack started in a docker container and mapped to my computer’s “localhost:4566”

Everything works fine when I actually deploy to AWS/CDK but does not work when I try localstack/CDK.

Troubleshooting

I feel like I’ve tried just about everything to get this to work, but no luck yet (including solutions from the other issues like https://github.com/localstack/aws-cdk-local/issues/36#issuecomment-743919267 & https://github.com/localstack/aws-cdk-local/issues/38). Here’s what I’ve tried:

  • Deleting node_modules and cdk.out, then combinations of installing aws-cdk-local 1.65.3 & aws-cdk 1.86.0/1.89.0, globally/locally

  • Executing locally installed packages via “npx” command (e.g. npx cdklocal bootstrap)

  • Using cdklocal --profile flag with my actual account name and also with “default”

Setup

I can start my localstack just fine on Windows 10 and also in docker: http://localhost:4566/health

"services": {
"cloudwatch": "running",
"iam": "running",
"lambda": "running",
"logs": "running",
"apigateway": "running"
}

C:/Users/me/.aws/config

[default]
sso_start_url = https://________.com/start
sso_region = us-west-2
sso_account_id = 9999999
sso_role_name = 9999999_MyRoleName
region = us-west-2
ca_bundle = C:\Program Files\Amazon\AWSCLIV2\mycert.pem
output = json[default]

C:/Users/me/.aws/credentials

[default]
aws_access_key_id=test
aws_secret_access_key=test
region=us-west-2

[(my account id)]
aws_access_key_id=(my key id)
aws_secret_access_key=(my access key)
aws_session_token=(my token)
region=us-west-2

package.json

"devDependencies": {
  ...
  "aws-cdk": "1.86.0",
  "aws-cdk-local": "^1.65.3",
  "typescript": "~3.9.7"
},
"dependencies": {
  "@aws-cdk/aws-ec2": "1.86.0",
  "@aws-cdk/aws-apigateway": "1.86.0",
  "@aws-cdk/aws-lambda": "1.86.0",
  "@aws-cdk/aws-logs": "1.86.0",
  "@aws-cdk/core": "1.86.0",
  ...
}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 17 (6 by maintainers)

Most upvoted comments

@edible-programs We just (2023-02-15T12:22:38.576Z) released a new version of aws-cdk-local 2.17.0, which implements an IPv4 fallback to fix IPv6-related issues on macOS. See: https://github.com/localstack/aws-cdk-local/pull/80

@whummer Sorry but that’s really outdated stuff now, but the method that I had specified, works fine.

Same issue here. Even bootstrapping does not work.

❯ cdklocal bootstrap            
'@aws-cdk/core:newStyleStackSynthesis' context set, using new-style bootstrapping
 ⏳  Bootstrapping environment aws://708XXXXXXXXX/ap-northeast-1...
 ❌  Environment aws://708XXXXXXXXX/ap-northeast-1 failed bootstrapping: Error: Need to perform AWS calls for account 708XXXXXXXXX, but the current credentials are for 000000000000

My stacks are configured to deploy to specific environments with hard-coded account IDs.