Boto3: Provide environment variables to override default endpoint URL

Created on 29 Aug 2019  路  2Comments  路  Source: boto/boto3

In a world of environment variables used as configuration to switch between environments, it would be really useful if boto3 would support an variable to switch between endpoints.

In our use case we want to use boto3 with minio https://min.io in the dev and continuous integration environments and switching with a variable such as AWS_S3_ENDPOINT_URL would be super useful.

Right now, we have to hack our way though some custom python code, or have some startup writing of an aws configuration file, which is not ideal.

See https://docs.min.io/docs/aws-cli-with-minio for how the "alternative" entrypoint is used.

feature-request

Most helpful comment

It would be nice to have as in some cases boto3 is used as dependency and there's no way to access it's constructor - environment variables is the only way to change configuration.

All 2 comments

@arthurlogilab - Thank you for your post. I would mark this as a feature request. But for now as a workaround you can use endpoint_url during client creation.

Here is the documentation for how to use endpoint_url during client creation:
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html

It would be nice to have as in some cases boto3 is used as dependency and there's no way to access it's constructor - environment variables is the only way to change configuration.

Was this page helpful?
0 / 5 - 0 ratings