Aws-vault: boto3 script and profile switching

Created on 14 Feb 2019  路  4Comments  路  Source: 99designs/aws-vault

Hi,
I need a help to use aws-vault in boto3 codes.

when I create boto3 script I can use .aws/credentials file passing the profile and also I can switch from one to another profile easly:
python session = boto3.Session(profile_name=my_aws_profile)

If I want to use aws-vault, Should I use env vars and call aws-vault everytime because credentials are saved in other place?

stale

Most helpful comment

just run aws-vault exec PROFILE -- python3 /PATH/YOUR_SCRIPT.py

All 4 comments

just run aws-vault exec PROFILE -- python3 /PATH/YOUR_SCRIPT.py

no it doesnt work as mentioned above. OR need to perform another configuration of boto

botocore.exceptions.InvalidConfigError: The source_profile "terraform_dev" must specify either static credentials or an assume role configuration

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

For anyone coming across this issue because of the error below it seems this is caused by an old version of awscli (in my case ubuntu 18.04's default version). I believe this would apply to the SDK as well.

The source_profile "terraform_dev" must specify either static credentials or an assume role configuration

Was this page helpful?
0 / 5 - 0 ratings