Visualize the AWS Cost and Usage Report (CUR) into Amazon QuickSight

Cagrihankara
7 min readJan 11, 2023

--

You need to require better visibility into your AWS usage to help them understand the return on your investment, achieve operational efficiency, and make business decisions that have financial impact. There may be some questions within your organization that need to be answered:

  • Which key areas should I focus to optimize my AWS usage and costs?
  • How do I track the impact of my cost optimization on my business?
  • How do I gain resource level granularity of the AWS services my workloads use?

You have access to raw cost and usage data through the AWS Cost and Usage (AWS CUR) reports. These reports contain the most comprehensive information about your AWS usage and costs. Financial teams need this data so they have an overview of their monthly, quarterly, and yearly AWS spend, but this data is equally valuable for technical teams who need detailed resource-level granularity to understand which resources are contributing to the spend. AWS Cost Explorer provides a high-level view of costs and usage, using the same dataset that is used to generate the AWS Cost and Usage Reports.

Architecture of Visualizing AWS Cost and Usage Reports with Amazon QuickSight

Resolution

You can ingest and visualize your AWS Cost and Usage Report (CUR) by doing the following:

1. Create a Cost and Usage Report

2. Setting up Athena (Cloud formation template)

3. Setting up IAM policy for QuickSight to access AWS services, in here Amazon Athena

4. Open the QuickSight console

5. Setting up QuickSight permissions

6. Choose Datasets from QuickSight console and choose New Data Set

7. Choose Athena. This opens the Amazon Athena workgroup and create data source

8. Create Analyses

9. Publish your Dashboard

Let’s get started

1. Create a Cost and Usage Report

You can use the Cost & Usage Reports page of the Billing and Cost Management console to create Cost and Usage Reports.

To create Cost and Usage Reports

1. Sign into the Billing and Cost Management console at https://console.aws.amazon.com/billing/home#/

2. On the navigation pane, choose Cost & Usage Reports.

3. Choose Create report.

4. For Report name, enter a name for your report.

5. For Additional report details, select Include resource IDs to include the IDs of each individual resource in the report.

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. Choose Next.

8. For S3 bucket, choose Configure.

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. Review the bucket policy and select I have confirmed that this policy is correct and choose Save.

11. For Report path prefix, enter the report path prefix that you want prepended to the name of your report.

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. For Report versioning, skip this because it will be selected after you choose Amazon Athena.

14. For Enable report data integration for, Amazon Athena.

15. Choose Next.

16. After you have reviewed the settings for your report, choose Review and Complete.

2. Setting up Athena (Cloud formation template)

Now you need to setup Athena using a CloudFormation template. Which is ready in your CUR bucket as a crawler.yaml. This template contains the necessary information to create the resources in Athena, Glue, S3 services.

First, you need to take Object URL for YAML file in S3 Bucket that you created for Cost and Usage Reports.

Go to CloudFormation console and click on select “Create New Stack” with new resources. Enter the Object URL.

After created stack, all resources you need will be ready to use.

Note: If you have not use Amazon Athena and it has not query result location, you need to set up this before go to Quicksight. Go to Amazon Athena console and select settings.

Note: If you are not using the bucket in a different account, you can follow this. But if you use crawler.yaml in a different account, you need to change the bucket names in this template.

3. Setting up IAM policy for QuickSight to access AWS services

Go to IAM console and select roles. Search for QuickSight role and select. Add AWSQuicksightAthenaAccess policy which is AWS-managed.

Note: If you need AWSQuickSighS3Policy and AWSQuickSightIAMPolicy, you can add like pictures in the below.

AWSQuickSightIAMPolicy
AWSQuickSightS3Policy

4. Open the QuickSight console

If you have not use QuickSight before, you should open and login with AWS user, etc.

5. Setting up QuickSight permissions

From the QuickSight home page, select Manage QuickSight.

Next, click on Security & Permissions from the left-hand side menu and then click on the Manage AWS permissions button to give access to Athena as shown in the screenshot here:

6. Choose Datasets from QuickSight console and choose New Data Set

7. Choose Athena. This opens the Amazon Athena workgroup and create data source

Choose Athena.

Enter a data source name and choose your workgroup (if you don’t create workgroup, default is primary ) and validate connection.

Create data source.

Select your Athena database as database, choose your bucket name as a table to visualize data.

8. Create Analyses

After created dataset, you can continue with analyses. On the left panel, choose analyses tab and continue with the create “New analysis” button.

Note: All graphics and analyses are up to you in this section. There is one example picture in the below. In this example, we selected two fields on_demand cost and usage_start_date. We selected KPI as visual type. We can see the daily cost difference thanks to this example.

After finish analyses, you can share our analyses as dashboard.

9. Publish Dashboard

Go to QuickSight Dashboards and open dashboard that you want to share.

You can share your dashboard with AWS users on the right top share button.

You can create a schedule and send email to whoever you want. For instance, if you want to send email daily, you can create a schedule like this:

You should enter your information to other places like email, schedule name, timezone, etc.

Here an example of email template:

References:

https://docs.aws.amazon.com/quicksight/latest/user/welcome.html

https://aws.amazon.com/premiumsupport/knowledge-center/quicksight-cost-usage-report/

Thank you so much for reading this article, I hope it has helped simplify the process of your case.

If you have any questions, please feel free to drop a comment or to write me on LinkedIn, and I’ll be happy to answer it for you.

If this article helped you out I’d appreciate you letting me know with a few claps or a follow on Medium, thank you.

--

--

Responses (1)