Boto3 for GovCloud

Dawid Laszuk published on
1 min, 95 words

When working with AWS in GovCloud, it turned out that the boto3 library is not configured to work with GovCloud by default. This is because the GovCloud region is not included in the default list of regions. To fix this, you can add the GovCloud region to the list of regions in the boto3 library. This can be done by adding the following code to your Python script:

import boto3
from botocore.config import Config

config = Config(
    region_name = 'us-gov-west-1',
    signature_version = 'v4',
    retries = {
        'max_attempts': 10,
        'mode': 'standard'
    }
)

client = boto3.client('s3', config=config)