Using Lambda function to create prefixes/folder like Athena when doing query

16 views Asked by At

When you run an AWS Athena Query, it typically stores the output in a specific order in an S3 bucket. For example: S3::BucketName//AWSLogs/2024/03/24/file.csv

I want to achieve the same using a Lambda function when the query is executed every day. When the Lambda function runs, I want it to create a new prefix:

S3::BucketName//AWSLogs/2024/03/new_day/file.csv
S3::BucketName//AWSLogs/2024/new_month/new_day/file.csv
  • New_day: Create a prefix/folder each day.
  • New_month: Create a prefix/folder each month.

Is it possible to do this? If so, any help would be greatly appreciated.

I wrote a Lambda function to do it, however it does not work the same as Athena.

0

There are 0 answers