skip to content
namnh

How to set up multiple AWS accounts manually

/ 1 min read

Table of Contents

1. Obtain Access Keys

Go to the AWS Console:

IAM > Security Credentials > Access Keys

Create or retrieve your Access Key ID and Secret Access Key.

2. Configure AWS Credentials File

Edit or create the file: ~/.aws/credentials

[default]
aws_access_key_id = {{aws_access_key_id}}
aws_secret_access_key = {{aws_secret_access_key}}
[{{profile_name}}]
aws_access_key_id = {{aws_access_key_id}}
aws_secret_access_key = {{aws_secret_access_key}}

3. Configure AWS Config File

Edit or create the file: ~/.aws/config

[default]
region = {{region}}
output = {{output_format}} # e.g., json or text
[profile {{profile_name}}]
region = {{region}}
output = {{output_format}} # e.g., json or text

4. Use AWS CLI with Profiles

Install the AWS CLI if you haven’t already.

Run commands using the default or a named profile:

Terminal window
#s Using the default profile
aws ec2 describe-instances
# Using a custom profile
aws ec2 describe-instances --profile {{profile_name}}