cdk <command> --profile <named profile> tries default regardless
See original GitHub issuecdk commands does not pick up the named profile from .aws/credential
and ./aws/config
. the profile is configured thru aws configure
and in the format as specified in the aws doc. (two files, [<profile name>]
in credential file and [profile <profile name>]
in config file.
Reproduction Steps
create the profile
specify account number and region in the stack env.
run cdk synth or cdk deploy with --profile <profile name>
Error Log
[Error at /test-stack] Need to perform AWS calls for account ************, but no credentials found. Tried: default credentials.
Found errors
Environment
- **CLI Version : 1.16.3 **
- **Framework Version: 1.16.3 **
- OS : mac os
- **Language : python **
Other
Also tried to remove the [default] blocks in the .aws/ files, still same error.
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:24 (7 by maintainers)
Top Results From Across the Web
aws cdk to use non-default profile - Stack Overflow
By default, CDK commands will use the default AWS CLI profile. However, you can specify a named profile for a project by adding...
Read more >How to use a different Profile in AWS CDK | bobbyhadz
We can set the profile in a CDK command by passing the `--profile` flag. ... the profile we've specified, or the default one...
Read more >Chapter 2. Using CDK Red Hat Container Development Kit 3.12
By default, the minishift command places all runtime state into ~/.minishift. ... Profile names can only consist of alphanumeric characters.
Read more >How to migrate from CloudFormation to AWS CDK - part 1
You can essentially use AWS CDK command-line tool to make a better ... specify the name of the profile, if the profile name...
Read more >AWS CDK Toolkit (cdk command) - AWS Documentation
The AWS CDK Toolkit, the CLI command cdk , is the primary tool for interacting with your AWS CDK app. ... Do not...
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 FreeTop 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
Top GitHub Comments
This solution is works for me:
~/.aws/config
~/.aws/credentials
command to deploy:
cdk deploy --profile=testProfile
Environment
Try with the --verbose flag to get the error. In my case, it was
Unable to determine the default AWS account: InvalidClientTokenId: The security token included in the request is invalid.
And it turned out thataws_secret_access_key
contains the plus (+) sign that causes the issue.