Currently, there is no API or CloudFormation/Terraform resource to programmatically enable Cost Explorer preferences, specifically the "Resource-level data at daily granularity" setting. This must be done manually through the AWS Console at:
Cost Management > Preferences > Cost Explorer > Historical and granular data
Current Limitation
When managing AWS Organizations with multiple accounts or automating infrastructure deployment, we cannot include Cost Explorer preference configuration in our Infrastructure-as-Code workflows. This requires manual console access to the management account and creates:
- Consistency issues - Settings may be configured differently across accounts or Organizations
- Automation gaps - Cannot fully automate account setup for cost visibility
- Scalability problems - Manual configuration doesn't scale for organizations with many accounts
- Onboarding friction - New teams/accounts require manual intervention by admins
Requested Feature
Add API support for Cost Explorer preference management, including:
API Actions:
UpdateCostExplorerPreferences - Configure all preference settings
GetCostExplorerPreferences - Retrieve current settings
EnableResourceLevelData - Specifically enable resource-level tracking for services
CloudFormation/Terraform Support:
AWS::CostExplorer::Preferences CloudFormation resource
aws_ce_preferences Terraform resource
Example Use Case:
import boto3
ce_client = boto3.client('ce')
# Enable resource-level data for specific services
ce_client.update_cost_explorer_preferences(
EnableMultiYearData=True,
ResourceLevelData={
'Enabled': True,
'Services': ['ALL_SERVICES'],
'Granularity': 'DAILY'
}
)
Business Impact
- DevOps Teams: Can include cost monitoring setup in CI/CD pipelines
- FinOps Teams: Can ensure consistent cost visibility across all accounts
- Enterprise Organizations: Can automate onboarding with proper cost tracking from day one
- Compliance: Can enforce cost visibility standards programmatically
Workaround
Currently, the only workaround is manual console configuration by someone with management account access, which doesn't scale.
Related AWS Services
This feature would complement existing programmatic capabilities:
- Cost Allocation Tags API (recently added)
- Cost Explorer API for querying data
- AWS Budgets API
- Cost Anomaly Detection API
All of these allow programmatic management except for the initial preference configuration itself.
Additional Context
- The Cost Explorer API already exists for querying data, but there's no API to configure the preferences that determine what data is available
- Cost allocation tags now have API support (via
aws_ce_cost_allocation_tag)
- This gap affects both small teams and large enterprises managing multiple AWS Organizations