AWS CUR Report Definition
This page shows how to write Terraform and CloudFormation for CUR Report Definition and write them securely.
aws_cur_report_definition (Terraform)
The Report Definition in CUR can be configured in Terraform with the resource name aws_cur_report_definition
. The following sections describe 4 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_cur_report_definition" "default" {
# AWS Cost and Usage Reports are only available via us-east-1 APIs, so
# we set the provider for this resource to be us-east-1
provider = aws.aws-root-account-us-east-1
report_name = "MOJ-CUR"
resource "aws_cur_report_definition" "report" {
provider = aws.use1
report_name = "billing"
time_unit = "DAILY"
format = "textORcsv"
resource "aws_cur_report_definition" "this" {
report_name = module.label.id
time_unit = var.time_unit
format = var.format
compression = var.compression
additional_schema_elements = var.additional_schema_elements
resource "aws_cur_report_definition" "cloudability" {
report_name = "Cloudability"
time_unit = "HOURLY"
format = "textORcsv"
compression = "GZIP"
additional_schema_elements = ["RESOURCES"]
Parameters
-
additional_artifacts
optional - set of string -
additional_schema_elements
required - set of string -
compression
required - string -
format
required - string -
id
optional computed - string -
refresh_closed_reports
optional - bool -
report_name
required - string -
report_versioning
optional - string -
s3_bucket
required - string -
s3_prefix
optional - string -
s3_region
required - string -
time_unit
required - string
Explanation in Terraform Registry
Manages Cost and Usage Report Definitions.
NOTE: The AWS Cost and Usage Report service is only available in
us-east-1
currently. NOTE: If AWS Organizations is enabled, only the master account can use this resource.
AWS::CUR::ReportDefinition (CloudFormation)
The ReportDefinition in CUR can be configured in CloudFormation with the resource name AWS::CUR::ReportDefinition
. The following sections describe 2 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: AWS::CUR::ReportDefinition
Properties:
Compression: !Ref Compression
Format: !Ref Format
RefreshClosedReports: "True"
ReportName: !Ref ReportName
"AWS::CUR::ReportDefinition": {
"Type": "AWS::CUR::ReportDefinition",
"Properties": {}
},
"AWS::GameLift::Script": {
"Type": "AWS::GameLift::Script",
Parameters
AdditionalArtifacts
A list of manifests that you want Amazon Web Services to create for this report.
Required: No
Type: List of String
Update requires: No interruption
AdditionalSchemaElements
A list of strings that indicate additional content that Amazon Web Services includes in the report, such as individual resource IDs.
Required: No
Type: List of String
Update requires: Replacement
BillingViewArn
The Amazon Resource Name (ARN) of the billing view. You can get this value by using the billing view service public APIs.
Required: No
Type: String
Update requires: Replacement
Compression
The compression format that Amazon Web Services uses for the report.
Required: Yes
Type: String
Update requires: No interruption
Format
The format that Amazon Web Services saves the report in.
Required: Yes
Type: String
Update requires: No interruption
RefreshClosedReports
Whether you want Amazon Web Services to update your reports after they have been finalized if Amazon Web Services detects charges related to previous months. These charges can include refunds, credits, or support fees.
Required: Yes
Type: Boolean
Update requires: No interruption
ReportName
The name of the report that you want to create. The name must be unique, is case sensitive, and can't include spaces.
Required: Yes
Type: String
Update requires: Replacement
ReportVersioning
Whether you want Amazon Web Services to overwrite the previous version of each report or to deliver the report in addition to the previous versions.
Required: Yes
Type: String
Allowed values: CREATE_NEW_REPORT | OVERWRITE_REPORT
Update requires: Replacement
S3Bucket
The S3 bucket where Amazon Web Services delivers the report.
Required: Yes
Type: String
Update requires: No interruption
S3Prefix
The prefix that Amazon Web Services adds to the report name when Amazon Web Services delivers the report. Your prefix can't include spaces.
Required: Yes
Type: String
Update requires: No interruption
S3Region
The Region of the S3 bucket that Amazon Web Services delivers the report into.
Required: Yes
Type: String
Update requires: No interruption
TimeUnit
The granularity of the line items in the report.
Required: Yes
Type: String
Update requires: Replacement
Explanation in CloudFormation Registry
The definition of AWS Cost and Usage Report. You can specify the report name, time unit, report format, compression format, S3 bucket, additional artifacts, and schema elements in the definition.
Frequently asked questions
What is AWS CUR Report Definition?
AWS CUR Report Definition is a resource for CUR of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS CUR Report Definition?
For Terraform, the ministryofjustice/aws-root-account, reireias/aws-terraform and seiji/terraform-aws-modules source code examples are useful. See the Terraform Example section for further details.
For CloudFormation, the Road-To-FinOps-Deploy/aws_cf_cur and mhlabs/aws-icons-directory source code examples are useful. See the CloudFormation Example section for further details.