Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python boto3- How to work on cross region

Tags:

python

boto3

I started writing my lambda function using python and boto3,

I managed to work on every region separately but I didn't see how I can work in a few regions together.

This is how I announce my client:

region= 'ap-southeast-2'
ec2 = boto3.client('ec2', region_name=region)

If I do not give it a region it will run on the region you created your lambda function on, which is something I don't want.

Did anyone did it before?

like image 738
Shahar Hamuzim Rajuan Avatar asked Oct 16 '25 15:10

Shahar Hamuzim Rajuan


1 Answers

If you do not give it a region it will use the region your Lambda function is running in.

If you want to make AWS API calls in multiple regions via Boto3 you will have to create a client object for each region, and make separate API calls for each region.

like image 68
Mark B Avatar answered Oct 18 '25 16:10

Mark B



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!