AWS data wrangler error: WaiterError: Waiter BucketExists failed: Max attempts exceeded

Viewed 1766

I am trying to read data from athena into python's pandas dataframe. However, I encounter this error

WaiterError: Waiter BucketExists failed: Max attempts exceeded. Previously accepted state: Matched expected HTTP status code: 404

Do anyone have the same problem when using data wrangler? This is my code below

import awswrangler as wr
import pandas as pd
wr.athena.read_sql_query('select * from ath_bi_orders limit 10', database='default')
2 Answers

I have faced the same issue and resolved it by specifying AWS_DEFAULT_REGION env variable.

Like this.

os.environ['AWS_DEFAULT_REGION'] = 'ap-northeast-1' # specify your AWS region.

Execute it before you throw the query.

If you have the AWS CLI installed you can also set the region with aws configure:

> aws configure
AWS Access Key ID [********************]:
AWS Secret Access Key [********************]:
Default region name [None]: us-east-1
Default output format [json]:

This fixed the error for me when I was using AWS datawrangler to run an Athena query.

Related