CloudWatch Dashboard to manage & monitor a budget
In CloudWatch dashboard, is it possible to use math expressions (e.g. based on EstimatedCharges or some other metric) to create a metric that shows a budget, with month-to-month cloud spending gradually deducted from that budget?
Example: Suppose there is a starting budget of $1000. The cloud spend is $200 in the first month, and $100 in the second. Hence, the metric needs to have an initial value of $1000, which decreases to $800 at the end of the first month, and $700 at the end of the second month.
Can I use CloudWatch Dashboards with math expressions for this, or would other services be needed? e.g. QuickSight, Lambda?
This graph would be approximately what you need, where you are plotting 1000 less the running total of your estimate spend
.
{
"metrics": [
[ { "expression": "1000 - RUNNING_SUM(monthly)", "label": "Expression1", "id": "budget" } ],
[ "AWS/Billing", "EstimatedCharges", "Currency", "USD", { "id": "monthly", "visible": false } ]
],
"view": "timeSeries",
"stacked": false,
"region": "us-east-1",
"stat": "Maximum",
"period": 2592000
}
However, it is difficult to get exact value of spend in a month. To get exact values you would be better off querying AWS Cost Explorer. CloudWatch Dashboards has a Custom Widget feature that comes with a simple AWS Cost Explorer report. It would be relatively easy to adapt the code in that to display what you need.
Relevant questions
Storage Burst Balance - Cloudwatch Alarm - EBS, EFS, etc.
asked 5 months agoCloudWatch Dashboard: Is there a way to create a link to a specific Text widget?
asked 8 days agoScale errors on simple CloudWatch Dashboard
Accepted Answerasked 6 months agoAmazon QuickSight - is it possible to fully automate a dashboard creation with AWS SDK
Accepted Answerasked 2 years agoControl CloudWatch Dashboard plot attributes, like line color?
asked 3 years agoCannot Publicly Share CloudWatch Dashboard
asked 3 months agoCloudWatch Dashboard
Accepted Answerasked 2 years agoCan CloudWatch metric filters be created on logs in a different account?
Accepted Answerasked 2 months agoRecreate "monitoring" tab as a dashboard in cloudwatch
asked 6 months agoCloudWatch Dashboard to manage & monitor a budget
asked 3 months ago