Need to perform AWS calls for account XXX, but no credentials have been configured but they are
See original GitHub issueDescribe the bug
I have aws CLI configured, I have ~/.aws/config
[jedrek]
region = eu-central-1
and ~/.aws/credentials
[jedrek]
aws_access_key_id = XXXXXXXX
aws_secret_access_key = XXXXXX
Configured my Stack for my account and region
const app = new cdk.App();
new Ec2NatInstanceStack(app, 'Ec2NatInstanceStack', {
env: { region: 'eu-central-1', account: 'XXXXXXXXXXX' }
});
But cdk synth
still raises an error Need to perform AWS calls for account XXX, but no credentials have been configured
import * as cdk from '@aws-cdk/core';
import { Construct } from 'constructs';
import * as ec2 from '@aws-cdk/aws-ec2';
export class Ec2NatInstanceStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
//===========================================================
// NAT Instance
//===========================================================
const natGatewayProvider = ec2.NatProvider.instance({
instanceType: new ec2.InstanceType('t3.small'),
});
//===========================================================
// VPC
//===========================================================
const vpc = new ec2.Vpc(this, 'MyVpc', {
natGatewayProvider,
natGateways: 1,
});
}
}
Expected Behavior
cdk-synth
works fine
Current Behavior
Need to perform AWS calls for account XXX, but no credentials have been configured
Reproduction Steps
Create Stack as above and try to cdk synth
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.29.1 (build c42e961)
Framework Version
No response
Node.js Version
v18.4.0
OS
MacOS 12.3.1
Language
Typescript
Language Version
No response
Other information
No response
Issue Analytics
- State:
- Created a year ago
- Comments:17 (7 by maintainers)
Top Results From Across the Web
Need to perform AWS calls for account xxx, but no credentials ...
I have run aws configure and inserted the correct keys for the IAM user im using. So again, it only works when im...
Read more >awslabs/aws-cdk - Gitter
I keep getting: Need to perform AWS calls for account XXXX-XXXX-XXXX, but no credentials found. Tried: default credentials. I've tried ENV variables: ...
Read more >Troubleshooting - AWS Control Tower
If you encounter issues while using AWS Control Tower, you can use the following information to resolve them according to our best practices....
Read more >Detailed AWS setup - Architect documentation - Arc Codes
If you haven't yet set it up, here's a useful guide for Configuring the AWS CLI. In the context of a deployment tool,...
Read more >AWS CDKで "but no credentials have been configured ... - Qiita
AWS CDKに入門してbootstrapしようとしたら、"but no credentials have been configured" みたいなエラーが出てきて詰まったので、解決策をメモして ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ishanjain28 the CDK CLI does not have the capability to automatically pick the correct profile for the configured stack environment. The CLI needs some set of credentials to start with, and if you do not provide the
--profile
then it will assume that you are using thedefault
profile.If you have bootstrapped your accounts then there will be a set of IAM roles that have been created in those accounts. When you run a CDK command, the CLI will use your configured credentials to assume the bootstrapped roles in each account.
So for example if you run
npx cdk synth --profile=dev --all
it will use the credentials from yourdev
profile and will first assume a specific role in the target account.having same error here, even though I’m using --profile
I have multiple accounts configured. All of. them as
[profile profile-name]