I’m looking for a hand listing some of the services available in AWS for use in filtering budgets, which in turn are created by Terraform.
The Terraform reference page for the resource include a cost filter, shown in the snippet below.
resource "aws_budgets_budget" "ec2" {
name = "budget-terraform"
#---
# some details exluded for brevity
#---
cost_filter {
name = "Service"
values = [
"Amazon Elastic Compute Cloud - Compute",
"Elastic Container Services"
]
}
The example provides Amazon Elastic Compute Cloud - Compute
as the filter: which in the portal/console shows up under a different (but similar) name.
I’m trying to automate budgets across a number of different resource types (including tags) but can’t seem to find where the list of potential options in the values
field above is documented – on TF or AWS doco: Terraform references cost filter documentation under this link, which seems to me to be a dead end. My current approach of trying to use the portal and a bit of educated guess work is clunky: The images below show what I’ve punched into Terraform code, as well as how they appear in the portal, so there’s even a bit of guesswork (or typo’s your call) here, which seems a bad approach..
So – to the crux of the question:
Does anyone know some CLI call or reference material somewhere that one would use for getting a list of these names as they’d be used in filters?
Thanks!
2
Answers
So - for those interested in the solution to this one (as AWS/Terraform doesn't seem to have it documented well if at all), my solution was to click-ops it all together: and use the CLI to pull the data from the account, and pipe to jq to get the names of services I wanted:
aws budgets describe-budget --account-id 12345678910 --budget-name example-budget --no-paginate | jq .Budget.CostFilters.Service
For those that have run into the same issue (and don't wanna clickops): here's the output:
Here is the official documentation for Budget API information. I would check out page 68 first, as it has a few examples.
https://docs.aws.amazon.com/pdfs/aws-cost-management/latest/APIReference/awsbilling-api.pdf#API_pricing_Filter