Enable CUR in AWS
We recommend you to enable Cost and Usage Reports (CUR) for your AWS accounts to ensure that you have a copy of your comprehensive AWS usage data, before starting the onboarding process with DoiT. There is no charge for enabling Cost and Usage Reports, but storing the billing reports data in your Amazon S3 bucket is billed at standard Amazon S3 rates.
Supported formats
Currently, we support the following Cost and Usage Reports (CUR) file types:
- CSV
- Parquet
Create Cost and Usage Reports and the backfill request
To request data for the past 12 months:
-
Sign in to the AWS Billing and Cost Management console as an IAM user with administrator and billing privileges, or the root user of your organization's management account, which is the payer account of your organization.
-
Click this hyperlink to deploy our AWS CloudFormation stack: DoiT-CUR-Backfill-Stack.
-
Provide a name for the stack and the bucket, as an input to the stack. This will create all required resources and request the backfill.
Verify your cost data has backfilled
-
Sign in to the AWS S3 Console.
-
Select the bucket that you created to receive the reports.
AWS stores reports in the REPORT-PREFIX/REPORT-NAME
folder. Your report should be under the billing/aws-usage-report
folder.
AWS delivers all reports in a report date range in the same billing/aws-usage-report/YYYYMMDD-YYYYMMDD
folder. For more details, read about Amazon S3 organization and naming conventions.
DoiT-CUR-Backfill-Stack
YAML template
This CloudFormation YAML template creates AWS resources to manage and automate the AWS Cost and Usage Report (CUR), and start the cost allocation tag backfill process.
Parameters
BucketName
- Type:
STRING
- Description: Specifies the name of the Amazon S3 bucket to store the AWS Cost and Usage Report.
- Type:
Resources
-
MyCURReportBucket
- Type:
AWS::S3::Bucket
- Description: Creates an Amazon S3 bucket to store the AWS Cost and Usage Report.
- Properties:
BucketName
: Specifies the name of the S3 bucket.AccessControl
: Sets access control for the bucket to BucketOwnerFullControl.VersioningConfiguration
: Configures bucket versioning, currently suspended.
- Type:
-
CURReportBucketPolicy
- Type:
AWS::S3::BucketPolicy
- Description: Attaches a bucket policy to the CUR report bucket to allow access for the billingreports service.
- Properties:
Bucket
: References the created S3 bucket.PolicyDocument
: Defines permissions for the bucket policy.
- Type:
-
CURReport
- Type:
AWS::CUR::ReportDefinition
- Description: Defines the AWS Cost and Usage Report settings.
- Depends on:
CURReportBucketPolicy
- Properties:
ReportName
: Specifies the name of the CUR report.TimeUnit
: Sets the time unit for the report toHOURLY
.Format
: Sets the format of the report to text or CSV.Compression
: Specifies GZIP compression for the report.AdditionalSchemaElements
: Includes resource usage details in the report.S3Bucket
: References the S3 bucket for storing the report.S3Region
: Specifies the region for the S3 bucket.S3Prefix
: Defines the prefix for the report files.RefreshClosedReports
: Enables refreshing of closed reports.ReportVersioning
: Specifies to create a new report version.
- Type:
-
CostAllocationTagBackfillFunction
- Type:
AWS::Lambda::Function
- Description: Lambda function to start the cost allocation tag backfill process.
- Depends on:
CURReport
- Properties:
Handler
: Specifies the entry point for the Lambda function.Role
: Specifies the IAM role for the Lambda function.Code
: Includes the Lambda function code and installs the necessary dependencies (boto3
).Runtime
: Sets the runtime environment to Python 3.8.
- Type:
-
LambdaExecutionRole
- Type:
AWS::IAM::Role
- Description: IAM role for the Lambda function.
- Properties:
AssumeRolePolicyDocument
: Specifies the trust policy for the role.Policies
: Defines permissions for the Lambda execution role.
- Type:
-
BackfillCustomResource
- Type:
Custom::CostAllocationTagBackfill
- Description: Custom resource to trigger the cost allocation tag backfill process.
- Properties:
ServiceToken
: References the Lambda function to execute the backfill process.
- Type:
Outputs
BackfillStatus
- Description: Status of the cost allocation tag backfill process.
- Value: References the response from the custom resource.