Using two or more regions from a single profile in one AWS Account

25 Views Asked by At

I face a recent problem these days with my AWS structure. I have two accounts in AWS. One is the test environments and the other is the production.

The most cases i use aws cli to perform actions i want.

My setup:

  • config

    [default]
    region=eu-central-1
    output=json
    
    [profile test]
    region=eu-central-1
    output=json
    
    [profile prod]
    region=eu-central-1
    output=json
    
  • credentials

    [default]
    aws_access_key_id = AK_SOMETHING
    aws_secret_access_key = SAK_SOMETHING
    [test]
    role_arn = arn:aws:iam::<test_account>:role/OrganizationAccountAccessRole
    source_profile = prod
    [prod]
    aws_access_key_id = <random_variable>
    aws_secret_access_key = <random_variable>
    aws_session_token = <random_variable>
    

Now, in account prod with profile 'prod', i add in region ap-south-1 an another structure.

How do you suggest so i can make it to access to it?

I tried to edit the 'config' file like this:

[default]
region=eu-central-1
output=json

[profile test]
region=eu-central-1
output=json

[profile prod]
region=eu-central-1
output=json

and i connect correctly to my mumbai region resources, but in the future, i will always have to make this edit to connect.

0

There are 0 best solutions below