aramalipoor/aws-cost-saver

Add Support for environment variables to configure credentials

quickliketurtle opened this issue · 5 comments

Hello,
I'd like to suggest adding support for environment variables for profile, access key id, secret access key, default region, etc. replicating what the AWS cli and SDK's support.

I'm happy to contribute as well but wanted to see your interest first. :-)

Hi @quickliketurtle :)

Thanks for the suggestion, actually you can provide credentials via env variables:

export AWS_ACCESS_KEY_ID=xxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export AWS_REGION=eu-central-1

aws-cost-saver conserve --dry-run

Let me know if it doesn't work you.

Awesome, thanks for the reply. Then the only other thing I was thinking was supporting the exported AWS_PROFILE. My use case is that I don't set a 'default' profile since I work on a bunch of accounts... So on specific projects i export AWS_PROFILE=clientproject1...

@quickliketurtle you can specify profile by -p|--profile flag but I don't think there's any point of providing "profile" if you provide credentials via AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY 🤔

aws-cost-saver conserve --dry-run --profile my-other-profile

Useful quote from AWS docs:

Security credentials are account-specific. If you have access to multiple AWS accounts, you have separate credentials for each account.
https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html

Ok, would just fix my current workflow with other tools like aws cli, serverless framework, etc... If it's not useful to others, no need to add it... Thanks for talking it through. :-)

Cool, let me know if had any issues managing multiple client accounts :)