Amazon AWS CUR
This tutorial assumes that you have CUR (Cost and Usage Report) set up in your AWS environment. If this is not the case please follow the steps in Turning on the AWS Cost and Usage Report 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 these requirements you can go to the Amazon S3 service - Buckets and note the name and the region of our CUR S3 bucket.
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:
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.
- In the next screen: Service select S3, Actions select Read, Resources select Specific and in bucket click on Add ARN.
- 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.
- Add a User name and select Access type: Programmatic access.
- 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.
- On the next screen click on Download .csv we will use these credentials to populate our Exivity Extractor in the next section.
- Finally, click on Close.
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.
Once you have created the Extractor, go to the first tab: Variables
- Bucket: Type the name of your S3 CUR bucket.
- AWS region: The name of your S3 CUR bucket region code can be found in the Regions, Availability Zones, and Local Zones Documentation (Region column).
- 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 /).
Once you have filled in all details, go to the Run tab to execute the Extractor for a single day:
The Extractor requires one parameter 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.
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.
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:
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.
Once this is done you should be able to run any of the Accounts, Instances, Services or Invoices report types located under the Report menu for the date range you prepared the report for.