You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multi-account AWS Cost and Usage Report (CUR) aggregation and analysis. This module provides two submodules:
modules/source - Deployed in each source AWS account. Optionally creates CUR report definition, S3 bucket, and event notification (direct Lambda or SNS) to forward reports to the target account.
modules/target - Deployed in the central/target AWS account. Aggregates CUR reports from multiple source accounts using a Lambda function, with optional Athena/Glue analysis and IAM access management.
Creates AWS CUR report definition and S3 bucket in a source account, with cross-account access for the target Lambda. Both bucket and report creation are optional for accounts that already have them configured.
Supports two notification modes:
Direct Lambda (default) - S3 event triggers Lambda directly
S3 prefix for existing CUR report (only when create_report = false)
string
"cur-reports"
no
tags
Tags to apply to resources
map(string)
{}
no
Outputs
Name
Description
bucket_id
ID of the CUR S3 bucket
bucket_arn
ARN of the CUR S3 bucket
bucket_name
Name of the CUR S3 bucket
cur_report_name
Name of the CUR report (null if create_report = false)
cur_prefix
S3 prefix where CUR reports are stored
account_id
AWS Account ID
sns_topic_arn
ARN of the SNS topic (null if use_sns = false)
Target Module
Aggregates CUR reports from multiple source accounts into a central S3 bucket using Lambda, with optional Athena analysis.
Requirements
Name
Version
terraform
>= 1.5, < 2.0
aws
>= 5.27
Inputs
Name
Description
Type
Default
Required
cur_reports_bucket_name
Name of the S3 bucket for aggregated CUR reports
string
n/a
yes
source_accounts
Map of source account configurations
map(object)
{}
no
create_bucket
Whether to create a new S3 bucket
bool
true
no
enable_athena
Enable Athena/Glue for CUR analysis
bool
true
no
create_reader_role
Create IAM role for read-only access
bool
true
no
create_reader_user
Create IAM user with access keys
bool
false
no
lambda_function_name
Name of the Lambda function
string
"cur-forwarder"
no
glue_database_name
Glue database name for partition management
string
""
no
glue_region
AWS region for Glue catalog
string
"eu-west-1"
no
table_mapping
Map of destination_prefix to Glue table name
map(string)
{}
no
tags
Tags to apply to resources
map(string)
{}
no
Outputs
Name
Description
bucket_id
ID of the aggregated CUR S3 bucket
bucket_arn
ARN of the aggregated CUR S3 bucket
lambda_function_arn
ARN of the Lambda function
lambda_function_name
Name of the Lambda function
lambda_role_arn
ARN of the Lambda IAM role
athena_workgroup_name
Athena workgroup name
glue_database_name
Glue database name
reader_role_arn
IAM role ARN for read-only access
Bootstrap Script
For existing CUR data, use modules/target/scripts/bootstrap_partitions.py to create initial Glue partitions. Configure the variables at the top of the script and run: