# Amazon AWS CUR

## Pre-requisites

This tutorial assumes that you have CUR (Cost and Usage Report) set up in your AWS environment. In the event that this is not the case please follow the steps in [Turning on the AWS Cost and Usage Report](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-reports-gettingstarted-turnonreports.html) before proceeding.

Please note that we also need the following requisites:

* S3 bucket where the CUR reports are placed
* The AWS region of the S3 bucket
* The path where the reports are placed inside the S3 bucket

To get this requirements you can go to the Amazon S3 service - Buckets and note the name and the region of our CUR S3 bucket

![](https://3540922554-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-Lq5guLxhxhzIFzaRljC%2F-Lq5ikcXyGaWCoOkemzV%2FScreenshot_36.jpg?alt=media\&token=f1760c92-bdcb-4d27-9f17-1fb07d908968)

Once inside the CUR bucket, you must find the path where the monthly reports reside, please navigate the bucket until you find a folder like this one and note the path:

![In this case, cur is the path of the report (exivity\_cur\_report is the name of the report itself)](https://3540922554-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-Lq5guLxhxhzIFzaRljC%2F-Lq5jTKlcjHJ_ShSAjys%2Fimage.png?alt=media\&token=f337be57-c1cb-4e74-a1ec-997cee37a834)

## Obtaining the API Credentials

We have to create an IAM User that has read access to the CUR bucket. Please follow these steps:

* Go to **IAM** - **Policies** and click on **Create policy.**

![](https://3540922554-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-Lq5guLxhxhzIFzaRljC%2F-Lq5lRZHORS6itaSxziR%2Fimage.png?alt=media\&token=4665052d-d16e-4fe4-ae95-c8701d85057a)

* In the next screen:&#x20;  **Service** select *S3*, **Actions** select *Read*, **Resources** select Specific and in **bucket** click on *Add ARN.*

![](https://3540922554-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-Lq5lahC9rCIWDspcLj8%2F-Lq5muZmOq9wG39GXc1S%2Fimage.png?alt=media\&token=d11b61b7-5f43-4573-be9d-23d3bdfc7df1)

* In the next screen, type the name of your bucket followed by */\** in **Bucket name** (example: *billing-bucket/\**) and click on *Add.*
* Click on **Review Policy.**
* Give a **Name** and a **Description** to the policy and finally click on **Create policy.**

Now, we will attach the policy to a user:

* Go to **IAM** – **Users** – **Add user.**

![](https://3540922554-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-Lq5lahC9rCIWDspcLj8%2F-Lq5noPAD3-OlKODIiXB%2Fimage.png?alt=media\&token=c296da7e-c875-4fb9-bbe1-e3d9f1c7c7bf)

* Add an **User name** and select **Access type**: *Programmatic access*.

![](https://3540922554-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-Lq5lahC9rCIWDspcLj8%2F-Lq5o3tYGPWCN6Gs7_QO%2Fimage.png?alt=media\&token=ccfec413-a408-43d7-b986-6e18c59c5f23)

* Click on **Attach existing Policies directly** and filter by the name of the policy you just created.
* Select the policy and click on **Next:Tags.**
* Add a Key-Value pair for the Tags and click on **Next:Review.**
* Click on **Create User.**
* In the next screen click on **Download .csv** we will use this credentials to populate our Exivity Extractor in the next section.
* Finally click on **Close.**

## Configure Extractor

To create the Extractor in Exivity, browse to **Data Sources > Extractors** and click the *Create Extractor* button. This will try to connect to the Exivity Github account to obtain a list of available templates. For AWS, please click *AWS\_CUR\_Extractor* from the list. Provide a name for the Extractor in the name field, and click the **Create** button.

![](https://3540922554-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-Lq5lahC9rCIWDspcLj8%2F-Lq5p7tM0RVUToBy4hgr%2Fimage.png?alt=media\&token=4649a517-08a6-4cf8-b2b0-4c0fda10a3fe)

Once you have created the Extractor, go to first tab: **Variables**

* **Bucket:** Type the name of your S3 CUR bucket.
* **AWS region:** Name of your S3 CUR bucket region code you can find them [here ](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html)(column Region).
* **Access key:** You can find it in the csv that you have downloaded in the previous section.
* **Secret key:** You can find it in the csv that you have downloaded in the previous section.
* **Cur report:** Type the name of your CUR report.
* **Bucket Directory**: Type the path that you got in the previous section (if there is more than one folder separate them with /).

![](https://3540922554-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-Lq5tyI54bcdO0Wx9WNK%2F-Lq5uB4OxhYzUhedWErO%2Fimage.png?alt=media\&token=8484e6c4-9429-4073-a476-6c107682a228)

Once you have filled in all details, go to the **Run** tab to execute the Extractor for a single day:

![](https://3540922554-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-Lq5qVBH19iR-HqnCmpM%2F-Lq5ra80t0VubZE4RdSQ%2Fimage.png?alt=media\&token=646b7370-9c25-4a47-9080-0a149cea5912)

The Extractor requires one parameters in *yyyMMdd* format:

* **from\_date** is the date for which you wish to collect consumption data.

When you click the **Run Now** button, you should get a successful result.

## Configure Transformer

Once you have successfully run your AWS CUR Extractor, you should be able to create a Transformer template via **Data Sources > Transformers** and click the **Create Transformer** button. Select the AWS CUR Transformer and run it for a single day as a test. Make sure that it is the same day as for which you extracted consumption data in the previous step.

## Create Report

Once you have run both your Extractor and Transformer successfully create a Report Definition via the menu option **Report Definition** via the menu **Reports > Definitions**:

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LHEKskLK6aXinV75Knl%2F-LMg6h46PYa2zRIM4aIw%2F-LMgRgI97NEbU5KopHCw%2FManual12.jpg?alt=media\&token=6dfff1dd-341d-4a1f-bcbf-3d66290f3fd9)

Select the column(s) by which you would like to break down the costs. Once you have created the report, you should then click the **Prepare Report** button after first making sure you have selected a valid date selector shown when preparing the report.![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LHEKskLK6aXinV75Knl%2F-LMg6h46PYa2zRIM4aIw%2F-LMgS-sUs8uBd0jk5bFC%2FManual13.jpg?alt=media\&token=3fd1f372-60bc-48f3-a339-bbcc0f0d0086)

Once this is done you should be able to run any of **Accounts**, **Instances**, **Services** or **Invoices** report types located under the *Report* menu for the date range you prepared the report for.
