Skip to content

Allow specifying region_name for Boto3#1287

Merged
dapollak merged 4 commits into
elementary-data:masterfrom
jonboulle:nell-add-aws-region
Nov 29, 2023
Merged

Allow specifying region_name for Boto3#1287
dapollak merged 4 commits into
elementary-data:masterfrom
jonboulle:nell-add-aws-region

Conversation

@jonboulle
Copy link
Copy Markdown
Contributor

@jonboulle jonboulle commented Nov 16, 2023

Add an --aws-region-name option to the CLI which gets passed through to the boto3 client used by the S3 client.

When initialising a Boto3 Session it's useful to be able to specify the AWS Region to which the client should connect.

Context:

We're trying to use elementary to write to a Cloudflare R2 bucket, which implements the S3 API. However, the S3 endpoints for these buckets do not encode the region, and hence the --s3-endpoint-url flag isn't sufficient to be able to configure elementary to successfully access the buckets.

Without this flag, it means we need write an AWS Profile configuration to disk and pass that in to elementary in order to override the region, which isn't desirable in contexts where we integrate elementary (e.g. invoking it from Airflow).

@dapollak
Copy link
Copy Markdown
Contributor

dapollak commented Nov 25, 2023

Hey @jonboulle, thanks for contributing to Elementary !
The change looks fine, except you must add the new cli option declaration so it will be possible to pass it as a cmd arg. See examples in cli.py

When initialising a [Boto3 `Session`](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/session.html#session-configurations) it's useful to be able to specify the AWS Region to which the client should connect.

Add an `--aws-region-name` option to the CLI which gets passed through to the `boto3` client used by the S3 client.

Context:

We're trying to use elementary to write to a Cloudflare R2 bucket, which implements the S3 API. However, the S3 endpoints for these buckets do not encode the region, and hence the `--s3-endpoint-url` flag isn't sufficient to be able to configure elementary to successfully access the buckets.

Without this flag, it means we need write an AWS Profile configuration to disk and pass that in to elementary in order to override the region, which isn't desirable in contexts where we integrate elementary (e.g. invoking it from Airflow).
@jonboulle
Copy link
Copy Markdown
Contributor Author

Hey @jonboulle, thanks for contributing to Elementary ! The change looks fine, except you must add the new cli option declaration so it will be possible to pass it as a cmd arg. See examples in cli.py

Oh gosh, how did I miss that 🤦 . Added!

@dapollak dapollak merged commit b3755fd into elementary-data:master Nov 29, 2023
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.

2 participants