Home > Enterprise >  AWS credential file - Can I have more than one?
AWS credential file - Can I have more than one?

Time:01-25

I use a VPC connection to an RDS mySql DB... the credentials I use I cannot reuse to connect to an S3 bucket. I have keys and token but I cannot add to that credential file. Is is stored in my SSH folder and I cannot edit it.
Is there a way to have more than one credential file one for RDS and one for S3?

CodePudding user response:

Use named profiles. configure additional profiles by using aws configure with the --profile option

or add access key and secret in ~/.aws/credentials (Linux & Mac) or %USERPROFILE%.aws\credentials (Windows) files as below

[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

[user1]
aws_access_key_id=AKIAI44QH8DHBEXAMPLE
aws_secret_access_key=je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY

Use as below

aws ec2 describe-instances --profile user1

follow the below link for more details. https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

  • Related