How to switch between multiple accounts with AWS SDK

0 votes

Im currently using the credential file (~/.aws/credentials) to initialize the SDK.

Credential File format.


My requirement is to switch between multiple aws accounts. I'm currently trying to resolve this by overwriting the file with new credentials and re initialize the sdk. Is there any other efficient workaround to resolve this ? Thanks in Advance.

Aug 24, 2018 in AWS by bug_seeker
• 14,970 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
+1 vote

You can define multiple profiles in ~/.aws/credentials and refer to the profile in your SDK initialization. See: A New and Standardized Way to Manage Credentials in the AWS SDKs which also shows examples for each language.

aws_access_key_id = ACCESS_KEY
aws_secret_access_key = SECRET_KEY
aws_session_token = TOKEN
aws_access_key_id = Alice_access_key_ID
aws_secret_access_key = Alice_secret_access_key
aws_access_key_id = Bob_access_key_ID
aws_secret_access_key = Bob_secret_access_key

answered Aug 24, 2018 by Priyaj
• 56,120 points

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer

How to use AWS CLI with Elastic Beanstalk?

You have to create a source bundle ...READ MORE

answered Sep 28, 2018 in AWS by Archana
• 3,770 points
0 votes
1 answer

How to update shadow with Single AWS IOT rule

You need to use + instead of ...READ MORE

answered Oct 15, 2018 in AWS by Priyaj
• 56,120 points
+3 votes
1 answer

How to download aws sdk in my eclipse?

To use AWS SDK simply follow the ...READ MORE

answered Dec 11, 2018 in AWS by Priyaj
• 56,120 points
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to add SSL certificate to AWS EC2 with the help of new AWS Certificate Manager service

refer this link You can't install the certificates ...READ MORE

answered Jul 19, 2018 in AWS by Priyaj
• 56,120 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.