Monitor and optimize costs with AWS Cost Management
awsAWS Cost Management is a feature group for monitoring, forecasting, and optimizing costs. Billing has similar features. Billing is for managing present costs whereas Cost Management seems to target future costs.
Cost Explorer
Cost Explorer can show costs grouped and filtered by services and regions etc.
With filtering with Usage type filter, you can see costs for data transfer from ELB and EC2.
Budgets
Budgets can notice that set budgets have been exceeded and report the usage with email etc. periodically.
If you are using CDK, you can set budgets as follows. There is no L2 Constructs currently, so write it with referring to AWS::Budgets::Budget docs.
import * as budgets from 'aws-cdk-lib/aws-budgets';
new budgets.CfnBudget(this, 'TestBudget', {
budget: {
budgetName: "testbudget2",
budgetLimit: {
amount: 60,
unit: "USD"
},
timeUnit: "MONTHLY",
budgetType: "COST",
costFilters: {
Region: ["ap-northeast-1"]
}
},
notificationsWithSubscribers: [
{
notification: {
notificationType: "ACTUAL",
comparisonOperator: "GREATER_THAN",
threshold: 99
},
subscribers: [
{
subscriptionType: "EMAIL",
address: "[email protected]"
},
]
}
]
})
Cost Anomaly Detection
Cost Anomaly Detection can notice services that is incurring costs more than usual with email etc.
Rightsizing Recommendations
Rightsizing Recommendations tell you EC2 instance whose resources are not fully used and estimate the savings by changing the type. This feature can be enabled with turning on “Amazon EC2 resource recommendations” check box at “AWS Cost Management > Preferences”