Comment on page
🚪

How to setup AWS CUR? How is Athena linked to AWS CUR?

AWS Cost and Usage Reports (CUR) is a service provided by Amazon Web Services (AWS) that enables users to create detailed reports of their AWS usage and costs. These reports can help users gain visibility into their AWS usage and costs, enabling them to optimize their spending and improve their overall efficiency.

How to setup AWS CUR?

  1. 1.
    Sign in to the Billing and Cost Management console at https://console.aws.amazon.com/billing/home#/
  2. 2.
    On the navigation pane, choose Cost & Usage Reports.
  3. 3.
    Choose Create report.
  4. 4.
    For Report name, enter a name for your report.
  5. 5.
    For Additional report details, select Include resource IDs to include the IDs of each individual resource in the report.
  6. 6.
    For Data refresh settings, select whether you want the AWS Cost and Usage Reports to refresh if AWS applies refunds, credits, or support fees to your account after finalizing your bill. When a report refreshes, a new report is uploaded to Amazon S3.
  7. 7.
    Choose Next.
  8. 8.
    For S3 bucket, choose Configure.
  9. 9.
    In the Configure S3 Bucket dialog box, do one of the following:
    • Select an existing bucket from the drop down list and choose Next.
    • Enter a bucket name and the Region where you want to create a new bucket and choose Next.
  10. 10.
    Review the bucket policy, and select I have confirmed that this policy is correct and choose Save.
  11. 11.
    For Report path prefix, enter the report path prefix that you want prepended to the name of your report.
  12. 12.
    For Time granularity, choose one of the following:
    • Hourly if you want the line items in the report to be aggregated by the hour.
    • Daily if you want the line items in the report to be aggregated by the day.
    • Monthly if you want the line items in the report to be aggregated by month.
  13. 13.
    For Report versioning, choose whether you want each version of the report to overwrite the previous version of the report or to be delivered in addition to the previous versions.
    Overwriting reports can save on Amazon S3 storage costs. Delivering new report versions can improve auditability of billing data over time.
  14. 14.
    For Enable report data integration for, select whether you want to enable your Cost and Usage Reports to integrate with Amazon Athena, Amazon Redshift, or Amazon QuickSight. The report is compressed in the following formats:
    • Athena: parquet format
    • Amazon Redshift or Amazon QuickSight: .gz compression
  15. 15.
    Choose Next.
  16. 16.
    After you have reviewed the settings for your report, choose Review and Complete.

Setting up Athena with AWS CUR using AWS CloudFormation templates

To streamline and automate integration of your Cost and Usage Reports with Athena, AWS provides an AWS CloudFormation template with several key resources along with the reports that you set up for Athena integration. The AWS CloudFormation template includes an AWS Glue crawler, an AWS Glue database, and an AWS Lambda event.
The Athena integration setup process using AWS CloudFormation removes any Amazon S3 events that your bucket might already have. This can negatively affect any existing event-based processes that you have for an existing AWS CUR report. We strongly recommend that you create both a new Amazon S3 bucket and a new AWS CUR report to use with Athena.
Before you can use a CloudFormation template to automate Athena integration, make sure that you do the following:
  • Create a new Amazon S3 bucket for your reports. For more information, see Creating a bucket in the Amazon S3 User Guide.
  • Create a new report to use with Athena. During the setup process, for Enable report data integration for, choose Athena.
  • Wait for the first report to be delivered to your Amazon S3 bucket. It can take up to 24 hours for AWS to deliver your first report.
To use the Athena AWS CloudFormation template:
  1. 1.
    Open the Amazon S3 console at https://console.aws.amazon.com/s3/.
  2. 2.
    From the list of buckets, choose the bucket where you chose to receive your AWS CUR report.
  3. 3.
    Choose your report path prefix (your-report-path-prefix/). Then, choose your report name (your-report-name/).
  4. 4.
    Choose the .yml template file.
  5. 5.
    Choose Object actions, and then choose Download.
  6. 6.
    Open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation.
  7. 7.
    If you have never used AWS CloudFormation before, choose Create New Stack. Otherwise, choose Create Stack.
  8. 8.
    Under Prepare template, choose Template is ready.
  9. 9.
    Under Template source, choose Upload a template file.
  10. 10.
    Select Choose file.
  11. 11.
    Choose the downloaded .yml template, and then choose Open.
  12. 12.
    Choose Next.
  13. 13.
    For Stack name, enter a name for your template and choose Next.
  14. 14.
    Choose Next.
  15. 15.
    At the bottom of the page, select I acknowledge that AWS CloudFormation might create IAM resources.
    This template creates the following resources:
    • Three IAM roles
    • An AWS Glue database
    • An AWS Glue crawler
    • Two Lambda functions
    • An Amazon S3 notification
  16. 16.
    Choose Create stack.