create_budget 'CostFilters' doesn't filter cost data with tag and service
yambottle opened this issue · comments
Describe the bug
Following boto3 latest(1.35.6) create_budget doc to create a budget with tag and service filter:
budget.create_budget(
AccountId=os.getenv("AWS_ID"),
Budget={
'BudgetName': f"test_ec2_monthly",
'BudgetLimit': {
'Amount': '100.00',
'Unit': 'USD'
},
'CostFilters': {
# 'Tag': [f'Contract:fmi_luthi'],
# 'TagKeyValue': [f'Contract$fmi_luthi'],
'TagKeyValue': [f'user:Contract$fmi_luthi'],
'Service': [
# 'AmazonEC2'
# 'Amazon EC2'
'EC2-Instances (Elastic Compute Cloud - Compute)',
'EC2-Other'
]
},
'CostTypes': {
'IncludeTax': True,
'IncludeSubscription': True,
'UseBlended': True,
'IncludeRefund': False,
'IncludeCredit': False,
'IncludeUpfront': True,
'IncludeRecurring': True,
'IncludeOtherSubscription': True,
'IncludeSupport': True,
'IncludeDiscount': False,
'UseAmortized': False
},
'TimeUnit': 'MONTHLY',
'BudgetType': 'COST',
},
NotificationsWithSubscribers=[
]
)
The test_ec2_monthly
budget is created, but wasn't filtered correctly(no cost data at all after applied cost filter).
This budget displays the correct filter on the budget parameter:
but there is no cost data in the preview in the edit:
However, manually removing and applying the same budget with the same filter through the edit budget console makes it works as expected(cost data showing on the preview).
Expected Behavior
create_budget with tag and service filter should filter the cost data correctly:
'CostFilters': {
# 'Tag': [f'Contract:fmi_luthi'],
# 'TagKeyValue': [f'Contract$fmi_luthi'],
'TagKeyValue': [f'user:Contract$fmi_luthi'],
'Service': [
# 'AmazonEC2'
# 'Amazon EC2'
'EC2-Instances (Elastic Compute Cloud - Compute)',
'EC2-Other'
]
},
Current Behavior
create_budget with tag and service showing empty cost data(seems like the cost data has been falsely filtered)
Reproduction Steps
- Create a cost allocate tag
Contract
- Tag EC2 instance and its related resources by this tag
Contract:fmi_luthi
- As a correct behavior comparison, manually create a budget on the AWS console filtered by tag
Contract:fmi_luthi
and serviceEC2-Instances (Elastic Compute Cloud - Compute)
,EC2-Other
- Use boto3 to create a new budget with the same filter. You'll see this budget has empty cost data once been created by boto3, but if you reapply the same filter on the AWS console by editing this budget, the cost data will show correctly.
budget.create_budget(
AccountId=os.getenv("AWS_ID"),
Budget={
'BudgetName': f"test_ec2_monthly",
'BudgetLimit': {
'Amount': '100.00',
'Unit': 'USD'
},
'CostFilters': {
# 'Tag': [f'Contract:fmi_luthi'],
# 'TagKeyValue': [f'Contract$fmi_luthi'],
'TagKeyValue': [f'user:Contract$fmi_luthi'],
'Service': [
# 'AmazonEC2'
# 'Amazon EC2'
'EC2-Instances (Elastic Compute Cloud - Compute)',
'EC2-Other'
]
},
'CostTypes': {
'IncludeTax': True,
'IncludeSubscription': True,
'UseBlended': True,
'IncludeRefund': False,
'IncludeCredit': False,
'IncludeUpfront': True,
'IncludeRecurring': True,
'IncludeOtherSubscription': True,
'IncludeSupport': True,
'IncludeDiscount': False,
'UseAmortized': False
},
'TimeUnit': 'MONTHLY',
'BudgetType': 'COST',
},
NotificationsWithSubscribers=[
]
)
Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.35.6
Environment details (OS name and version, etc.)
Ubuntu 22.04