Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to set the source IP address #3256

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

nveloso
Copy link

@nveloso nveloso commented Sep 17, 2024

I was looking into how I could set the source IP address and port when using boto3 but could not find a way. It turns out that I was not the only one looking into that. See #2742.

I looked into the botocore code and tried to add this functionality. Please let me know if something is not right.

I tested my code by creating a simple s3 listing where I specified my config with the new source_address parameter.

boto_config = Config(source_address=('...', 0))

s3 = boto3.client('s3', config=boto_config)
response = s3.list_objects_v2(Bucket='...', Prefix='...')

for content in response['Contents']:
    print(content['Key'])

Then I captured all packets using wireshark and ran my script. Confirmed on wireshark that the traffic to AWS was using the source address I specified in the Config object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant