0
votes

How do I enable multi-region access for boto3 code in AWS?

So when I configured my CLI using aws configure command and entered the secret key/ access ID, it chooses a region by default and sticks to it.

How do I enable multi-region access for the code?...Anyone has been through this before and could give any inputs?

1

1 Answers

1
votes

To specify region other than one set as default in CLI configuration, create a Config object with the region_name property for the region you want, and then pass them into your client.

import boto3
from botocore.config import Config

my_config = Config(
    region_name = 'us-west-2'
)

client = boto3.client('kinesis', config=my_config)

More about other configuration options like environment variables, you can see in official boto3 documentation for Configuration.