This step is used when there is a single CUR being delivered, and have it automatically update Athena/Glue when there are new versions and new months data.
We will follow the steps here: https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/setting-up-athena.html#use-athena-cf to implement the CloudFormation template, which will automatically update existing CURs, and include new CURs when they are delivered.
NOTE: IAM roles will be created, these are used to:
Add event notification to existing S3 buckets
Create s3 buckets and upload objects
Create and run a Glue crawler
Create and update a Glue database and tables
Please review the CloudFormation template with your security team.
We will build the following solution:
Log into the console via SSO. Go to the S3 dashboard, go to the bucket and folders which contain your CUR file. Open the CloudFormation(CF) file and save it locally:
Here is a sample of the CF file:
Go to the CloudFormation dashboard and create a stack:
Load the template and click Next:
Specify the details for the stack and click Next:
Review the configuration, click I acknowledge that AWS CloudFormation might create IAM resources, and click Create stack:
You will see the stack will start in CREATE_IN_PROGRESS:
Once complete, the stack will show CREATE_COMPLETE:
Click on Resources to view the resources that it will create:
Go to the AWS Glue dashboard:
Click on Databases and click the database starting with athenacurcfn:
View the table within that database and its properties:
You will see that the table is populated, the recordCount should be greater than 0. You can now go to Athena and load the partitions and view the cost and usage reports.