Gilang Chandrasa Thoughts, stories, and ideas

Setting Region in Boto3's Client

The documentation didn’t mention about passing region as parameter when you’re creating client on Boto3, but you get an error if you don’t set it.

client = boto3.client(
    'autoscaling',
    aws_access_key_id=AWS_ACCESS_KEY,
    aws_secret_access_key=AWS_SECRET_KEY,
)
...
NoRegionError: You must specify a region.

Turn out you can set the region by passing region_name.

client = boto3.client(
    'autoscaling',
    aws_access_key_id=AWS_ACCESS_KEY,
    aws_secret_access_key=AWS_SECRET_KEY,
    region_name='us-east-1'
)

That all for now!