aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code

Home Page:https://aws.amazon.com/cdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cdk diff : Need to perform AWS calls for account xxxxx, but no credentials have been configured

jcbutil opened this issue · comments

Describe the bug

~/.aws/credentials and ~/.aws/config are all setup properly but still encountering this error.

aws_sts
aws_conf

Expected Behavior

Successfull cdk diff execution.

Current Behavior

Error encountererd on cdk diff

Errors found:
[18:32:36] Determining if we're on an EC2 instance.
[18:32:36] Does not look like an EC2 instance.
[18:32:36] Toolkit stack: CDKToolkit
[18:32:36] Setting "CDK_DEFAULT_REGION" environment variable to eu-central-1
[18:32:36] Resolving default credentials
[18:32:36] Looking up default account ID from STS
[18:32:39] Could not refresh notices: Error: Request timed out
[18:32:56] Unable to determine the default AWS account (TimeoutError): Connection timed out after 300000ms

[18:33:12] Some context information is missing. Fetching...
[18:33:12] Setting "load-balancer:account=xxxxx:loadBalancerArn=arn$:aws:elasticloadbalancing:eu-central-1:644227882183:loadbalancer/net/k8s-default-xxxx-xxxx/xxxx:loadBalancerType=network:region=eu-central-1" context to {"$providerError":"Need to perform AWS calls for account xxxx, but no credentials have been configured","$dontSaveContext":true}
[18:33:12] Setting "vpc-provider:account=xxxxx:filter.vpc-id=vpc-xxxx:region=eu-central-1:returnAsymmetricSubnets=true" context to {"$providerError":"Need to perform AWS calls for account 644227882183, but no credentials have been configured","$dontSaveContext":true}

[18:33:26] Not making progress trying to resolve environmental context. Giving up.
[Error at /XXXXStack] Need to perform AWS calls for account xxxxx, but no credentials have been configured
Annotations.addMessage (/home/xxxxx/xxxx-IaC/node_modules/aws-cdk-lib/core/lib/annotations.js:1:1071)

Reproduction Steps

cdk diff --verbose

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.87.0 (build 9fca790)

Framework Version

No response

Node.js Version

v20.14.0

OS

Ubuntu

Language

TypeScript

Language Version

No response

Other information

No response

@jcbutil Good morning. Please confirm if you have tried using --profile parameter as described here to explicitly use named profile configured in your environment. For your use case, you need to use cdk diff --profile chnet --verbose.

Thanks,
Ashish

@jcbutil Good morning. Please confirm if you have tried using --profile parameter as described here to explicitly use named profile configured in your environment. For your use case, you need to use cdk diff --profile chnet --verbose.

Thanks, Ashish

Hi Ashish,
Yes I did execute cdk diff with --profile chnet but still encounter the same error.

@jcbutil Good morning. Please confirm if you have tried using --profile parameter as described here to explicitly use named profile configured in your environment. For your use case, you need to use cdk diff --profile chnet --verbose.
Thanks, Ashish

Hi Ashish, Yes I did execute cdk diff with --profile chnet but still encounter the same error.

@jcbutil Thanks for your response. Could you share the logs generated by command cdk diff --profile chnet --verbose? Kindly note that you need to configure profile chnet with credentials in ~/.aws/credentials file.

Also could you try using the latest CDK version and see if error goes away?

Error is perhaps thrown here.

Thanks,
Ashish

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.