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?
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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.