awswrangler.athena.create_athena_bucket

awswrangler.athena.create_athena_bucket(boto3_session: Session | None = None) str

Create the default Athena bucket if it doesn’t exist.

The bucket name is derived from the caller’s account ID and region (aws-athena-query-results-{account_id}-{region}). Because S3 bucket names are global, this function verifies that the bucket is owned by the caller’s account before returning; if another account owns it, a InvalidArgumentValue is raised to prevent query results from being written to a bucket controlled by a third party.

Parameters:

boto3_session (Session | None) – The default boto3 session will be used if boto3_session receive None.

Return type:

str

Returns:

Bucket s3 path (E.g. s3://aws-athena-query-results-ACCOUNT-REGION/)

Examples

>>> import awswrangler as wr
>>> wr.athena.create_athena_bucket()
's3://aws-athena-query-results-ACCOUNT-REGION/'