Skip to main content

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

  1. 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.

  2. Deploy our AWS CloudFormation stack, DoiT-CUR-Backfill-Stack, by clicking this link with our YAML template.

  3. Give a name to the stack and the bucket as an input to the stack, which will create all the required resources and request the backfill.

Create the backfill request

To request data for the past 12 months:

  1. After having created the CUR, access your DoiT-CUR-Backfill-Stack CloudFormation stack deployment in the AWS console, and select Next.

  2. In the Stack name and BucketName fields, enter a name and select Next.

  3. In the next page, don't modify any parameters and select Next.

  4. In the last page, acknowledge that AWS CloudFormation might create IAM resources, and select Submit.

Verify your cost data has backfilled

  1. Sign in to the AWS S3 Console.

  2. 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.

Info

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.

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.
  • 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.
  • 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 to HOURLY.
      • 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.
  • 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.
  • 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.
  • 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.

Outputs

  • BackfillStatus
    • Description: Status of the cost allocation tag backfill process.
    • Value: References the response from the custom resource.