Stacks on Stacks

Managing Multiple AWS Profiles

I recently needed to be able to use the AWS CLI for managing AWS resources in China’s Beijing Region. It took a little bit more than a simple Google search, so I thought I’d write a quick post on it. In addition, I still wanted to use the AWS CLI to manage resources in the us-west-2 region as well.

My searching eventually led me to AWS Named Profiles. After another few minutes of searching, I finally found the region abbreviation for Beijing, cn-north-1. Anyways, I’ve copied some of the config files in the Named Profile example and modified them to more accurately reflect my config:





region = us-west-2
output = text
s3 =
    signature_version = s3v4
cloudfront = true

[profile china]
region = cn-north-1
output = text

See the previously mentioned documentation on AWS Named Profiles for more details. Getting a list of running EC2 instances in Beijing was now as simple as:

aws ec2 describe-instances --profile china