I am trying to add cost-allocation tags to S3 resources created by Athena queries, in a way that I can analyze the S3 costs of different application related to Athena usage.
To achieve this, I am making use of the parameter s3_additional_kwargs
when calling Wrangler's read_sql_query
.
Having a tags
dictionary:
df = wr.athena.read_sql_query(
sql,
database=database,
ctas_approach=True,
chunksize=chunksize,
s3_additional_kwargs={'Tagging': '&'.join([f"{key}={value}" for key, value in tags.items()])}
)
Though, when I check the csv file at df.query_metadata.ResultConfiguration.OutputLocation
, these files have no tags.
I do have s3:PutObjectTagging
on the Athena bucket.
I am wondering what is going wrong or whether this is not the correct approach to achieve my goal.