Aws-cdk: CDK errors with no credentials have been configured if credentials file does not exist

Created on 23 Mar 2020  路  3Comments  路  Source: aws/aws-cdk

when running cdk deploy, if a file does not exist at ~/.aws/credentials, cdk will exit with the message Need to perform AWS calls for account 1234, but no credentials have been configured..

There are many ways to provide aws credentials that don't require the credentials file, so this should probably be fixed.

In the meantime, the fix is to simply create a file at the expected path (~/.aws/credentials)

Reproduction Steps

mv ~/.aws/credentials ~/.aws/credentials_backup
cdk deploy --verbose

Error Log

see above

Environment

  • CLI Version : 1.30.0 (build 4f54ff7)
  • Framework Version:
  • OS :
  • Language :

Other


This is :bug: Bug Report

bug efforsmall p1 packagtools

All 3 comments

using the environment variables:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION
works for me.

https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html

cdk version 1.57.0

@trondhindenes @DioNNiS - have you checked out this blog post which gets into how to use the cdk-credential plugin. It's a tool I'd recommend when working with cross-account actions.

I've found a fair amount of users who run into this message would have been saved a fair amount of grief if the plugin were used.

can you give it a go and let me know how it goes?

@shivlaks this bug (which I understand is fixed now) simply meant that a file had to exist on the filesystem for CDK to be able to work. I don't have any issues with authentication or credentials, I just found that this file needed to exist (empty or not).

Sidenote: I had a look at the credential-plugin now. As sweet as it looks, one of CDK's selling points is its cross-language support. This means that utilities and helpers also need to be cross-language. We're standardized on python for all our "iac" stuff and so this plugin wouldn't solve my issue since it seems to require a TS/JS-based cdk codebase.

Was this page helpful?
0 / 5 - 0 ratings