FinOps (Part 1): How to set up AWS CUR (Cost and Usage Report)

May 2, 2024

Introduction
Welcome to our blog series on FinOps where we'll discuss how to analyze and manage your cloud costs. In this opening post, we focus on simplifying the initial steps of managing AWS costs using AWS Cost and Usage Reports (CUR). We will first go over the steps to set up the CUR report and identify the scope for optimization.

What are CUR Reports?
AWS Cost and Usage Reports provide a detailed breakdown of your AWS usage and expenses, illustrating how charges are accrued across different services. These reports are essential for effective cost management and are stored in an Amazon S3 bucket, tailored to your specific monitoring needs.

Benefits of Using CUR for Cost Tracking

  1. Granularity: CUR offers highly detailed data, including usage by individual service instances and their associated costs.
  2. Customization: Users can specify what data is included in the reports, catering to comprehensive analytical needs.
  3. Integration: CUR integrates seamlessly with external tools for advanced data processing and cost optimization.

Setting Up CUR Traditionally
Creating an S3 Bucket via AWS CLI:
We can quickly navigate through the AWS Management Console or you can quickly create an S3 bucket using the AWS Command Line Interface (CLI) with the following command:

aws s3 mb s3://your-cur-bucket --region your-region
aws s3api put-bucket-acl --bucket your-cur-bucket --acl private
aws s3api put-bucket-versioning --bucket your-cur-bucket --versioning-configuration Status=Enabled

Configuring S3 Bucket Policies via CLI:
You can also attach a policy to the bucket to allow AWS services to deposit CUR data using this CLI command:

aws s3api put-bucket-policy --bucket your-cur-bucket --policy '{
  "Version": "2012-10-17",
  "Statement": [
	{
      "Effect": "Allow",
      "Principal": {
        "Service": "cur.amazonaws.com"
  	},
      "Action": "s3:PutObject",
      "Resource": "arn:aws:s3:::your-cur-bucket/*"
	}
  ]
}'

Enabling CUR Reports:
You can enable CUR reports directly via the AWS CLI by specifying your preferences for data granularity and specifics of the report:

aws cur put-report-definition --report-definition file://your-report-definition.json

Validation and Troubleshooting:
Check the S3 bucket for new report deliveries and ensure that report contents reflect chosen configurations.

Streamlined DagKnows Setup

You may have noticed that the steps above can be completely automated for robustness. DagKnows platform allows you to effortlessly automate these steps in Python or CLI. Here’s a link to the completely automated CUR report setup (https://community.dagknows.com/tasks/wB19e6CsXikO3Hd8TaiF).There are several obvious advantages to automating the steps:

  1. End-to-End CUR Configuration:
    • Single Interface Setup: Initiate CUR setup directly from the DagKnows dashboard, which automates the entire flow.
    • Automated S3 Bucket Creation: Automatically create and configure S3 buckets with the correct policies using predefined DagKnows tasks.
    • Policy Configuration and CUR Activation: Implement S3 bucket policies and activate CUR with a few clicks, significantly reducing manual configuration errors.
  2. Automated Validation:
    • Continuous Monitoring: DagKnows continuously monitors the S3 bucket and automatically validates the integrity and accuracy of CUR data.
    • Error Handling: Automatically detect and alert on common setup issues, offering suggestions for quick resolution.
CUR(Cost and Usage Report) Setup Runbook