Description
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
- Select this option if this issue appears to be a regression.
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
Activity