-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI: No credentials have been configured error for deployment in cn-north-1 region from EC2 instance not supporting IMDSv2 #32334
Comments
@sivakova Good morning. Below is some high level analysis:
Could you please check on your side if IMDSv1 is not disabled on your EC2 instance? Refer Get the full benefits of IMDSv2 and disable IMDSv1 across your AWS infrastructure, you may select either of values Also could you try using the latest version of AWS CDK lib (in addition to AWS CDK CLI)? Thanks, |
@mrgrain yes I am trying with the latest version and the issue is still there |
@ashishdhingra Hello! I am not able to check right now whether IMDSv1 is disabled on EC2 or not, but i was able to make request to http://169.254.169.254/ from the the instance and it works as expected |
Thanks for the confirmation. Does the error change at all or is it all the same? |
@mrgrain good day! Then for some further versions i stopped getting creds error. |
Describe the bug
I am trying to deploy resources form EC2 instance in cn-north-1 region
Metadata token fetch for IMDSv2 fails and it seems like fallback to IMDSv1 doesn't happen.
Default region us-east-1 is set in the end and deployment fails.
The issue with credentials in China region started since 2.163.0 aws-cdk version.
build 26-Nov-2024 11:11:13 [11:11:13] [trace] SdkProvider#withAwsCliCompatibleDefaults()
build 26-Nov-2024 11:11:13 [11:11:13] Looking up AWS region in the EC2 Instance Metadata Service (IMDS).
build 26-Nov-2024 11:11:14 [11:11:14] Unable to retrieve AWS region from IMDS: Error: Error fetching metadata token: TimeoutError: Connection timed out after 1000 ms
build 26-Nov-2024 11:11:14 [11:11:14] Unable to determine AWS region from environment or AWS configuration (profile: "default"), defaulting to 'us-east-1'
build 26-Nov-2024 11:11:14 [11:11:14] Toolkit stack: CDKToolkit
build 26-Nov-2024 11:11:14 [11:11:14] Setting "CDK_DEFAULT_REGION" environment variable to us-east-1
Error message:
build 26-Nov-2024 11:11:17 [11:11:17] red: debug: Need to perform AWS calls for account ******, but no credentials have been configured
build 26-Nov-2024 11:11:17 [11:11:17] red: debug: Need to perform AWS calls for account ******, but no credentials have been configured
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
The region is set to cn-north-1, credentials is successfully configured, deployment is successful
Current Behavior
The region is set to us-east-1 and credentials is not configured correctly
Reproduction Steps
Deploy any resource from EC2 instance in cn-north-1 region without configured environment variables specifying region, and without configuration file with default profile
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.171.1
Framework Version
No response
Node.js Version
23.3.0
OS
MacOS
Language
TypeScript
Language Version
5.6.3
Other information
No response
The text was updated successfully, but these errors were encountered: