About this question
I am currently working as a cloud solutions architect and managing multiple AWS accounts for different environments. How can I use the AWS profiles to manage Credentials and Configuration efficiently across this environment?
I am currently working as a cloud solutions architect and managing multiple AWS accounts for different environments. How can I use the AWS profiles to manage Credentials and Configuration efficiently across this environment?
Log in to share your answer and help other learners.
Log in to answerBest Answer · By JanBask AWS Expert
Answered on Mar 26, 2024
In the context of AWS, you can manage credentials and Configuration efficiently across multiple or different AWS accounts by using the AWS profile using several steps which are given below:-
Create AWS profiles
You can create AWS profiles for each environment in your AWS Credentials. You can also specify a default profile. Here is the example given of how you can create AWS profiles in the credentials file:-
[default]
Aws_access_key_id = YOUR_DEFAULT_ACCESS_KEY_ID
Aws_secret_access_key = YOUR_DEFAULT_SECRET_ACCESS_KEY
[development]
Aws_access_key_id = YOUR_DEVELOPMENT_ACCESS_KEY_ID
Aws_secret_access_key = YOUR_DEVELOPMENT_SECRET_ACCESS_KEY
Region = us-west-2
[testing]
Aws_access_key_id = YOUR_TESTING_ACCESS_KEY_ID
Aws_secret_access_key = YOUR_TESTING_SECRET_ACCESS_KEY
Region = us-east-1
[production]
Aws_access_key_id = YOUR_PRODUCTION_ACCESS_KEY_ID
Aws_secret_access_key = YOUR_PRODUCTION_SECRET_ACCESS_KEY
Region = eu-west-1Setting AWS profile environment variable
You can set the “aws profile” environment optionally for specifying which AWS profile to use of the CLI command. Here is the example given of setting the AWS profile environment variable:-
“export AWS_PROFILE=development”Switch between AWS profiles
You can also easily switch between AWS profiles by specifying the “profile” options in the Aws CLI Command. Here is the example given of listing S3 buckets by using a specific AWS profile:-
AWS S3 1s - - profile development
Use AWS SDK with profiles
When you are using AWS SDK in your coding then you can specify the profile name in the SDK Configuration or session initialization. Here is the example given by using Boto3 with an AWS profile:-
Import boto3
Session = boto3.Session(profile_name=’development’)
S3_client = session.client(‘s3’)
Buckets = s3_client.list_buckets()
For bucket in buckets[‘Buckets’]:
Print(bucket[‘Name’])Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.
Step-by-step AWS guides from industry experts
Common AWS interview questions, answered
Guides, tips and career advice on AWS from JanBask experts.
AWS How to Become an AWS Certified Solutions Architect
Learn how to become an AWS Solutions Architect with our complete guide. Discover exam requirements, salary potential, and…
AWS AWS Solution Architect Salary in 2025 by Location, Skills, and Experience
The AWS Solution Architect Salary varies as per location, job role, skills, and more. Read this blog to learn how much an AWS…
AWS AWS Certification Cost, Courses, Exam Details, Path & Salary : The Comprehensive Guide
How Much Does AWS Certification Cost In 2025- Get aws certification price, types, and AWS certification course fees for your…
AWS Why AWS Training Certification is a Game-Changer for Your Career in 2025
Discover why AWS training certification is crucial in 2025. Learn how it boosts career opportunities, skills, and salary…