Skip to content

RegionUtils.get_region makes extra boto call inspite of overriding the functionality #1041

@karthich

Description

@karthich

Describe the bug

Hey all,
We observed this issue when we upgraded from v1.1.0 to v1.2.0, where the connection latency times spiked in our applications. As part of the #727 issue, you removed the ability to suppress the boto call to run get_available_regions by passing a WrapperProperties field called IAM_REGION.

What is the purpose of this code snippet?
region_utils.py line 41-43

        region = props.get(prop_key)
        if region:
            return self.verify_region(region, session)

Previously this override was working because of these lines in 1.1.0
1.1.0...1.2.0#diff-096f5213d0dba3503b9233a743aa417ed0089a8d30ef04920e9360973e3c41a3L79-L80

Our applications are fully aware of the region our databases are hosted and we would like to suppress this boto call when we connect to the database.

Expected Behavior

IamAuthPlugin should not make a boto call to get_available_regions if WrapperProperties.IAM_REGION is passed as part of the connect call.

What plugins are used? What other connection properties were set?

IamAuthPlugin with iam_region='us-west-2'

Current Behavior

RegionUtils.get_region runs verify_region inspite of overriding the behavior which creates a boto call to session.get_available_regions that increases database connection latency.

Reproduction Steps

Before:
Connect to any RDS database using the IAMAuthPlugin in v1.1.0 where you pass in iam_region explicitly as part of the connection properties. Measure the connection times

After:
Connect to any RDS database using the IAMAuthPlugin in v1.2.0 where you pass in iam_region explicitly as part of the connection properties. Measure the connection times.

Connection times in before vs after will be very different.

Possible Solution

Dont run verify_region when region is passed in.

Additional Information/Context

No response

The AWS Advanced Python Wrapper version used

v1.2.0

python version used

3.11

Operating System and version

linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions