amazon-web-servicesterraformterraform-provider-awsaws-billing

List AWS Billing Filter options or names for use in Terraform


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..

Service name in TF code

Service names in portal

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?


Solution

  • 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:

    [
      "AWS X-Ray",
      "Amazon WorkSpaces",
      "Amazon WorkDocs",
      "AWS WAF",
      "Amazon Virtual Private Cloud",
      "AWS Transfer Family",
      "Amazon Timestream",
      "Tax",
      "AWS Systems Manager",
      "AWS Storage Gateway",
      "AWS Step Functions",
      "Amazon Simple Queue Service",
      "Amazon Simple Notification Service",
      "Amazon SimpleDB",
      "Amazon Simple Email Service",
      "AWS Service Catalog",
      "AWS Network Firewall",
      "Amazon OpenSearch Service",
      "Amazon QuickSight",
      "Amazon Redshift",
      "Amazon Registrar",
      "Amazon Rekognition",
      "Amazon Relational Database Service",
      "Amazon Route 53",
      "Amazon Simple Storage Service",
      "AWS Secrets Manager",
      "AWS Amplify",
      "Amazon API Gateway",
      "AWS Application Migration Service",
      "Amazon AppStream",
      "Amazon Athena",
      "AWS Backup",
      "AWS Certificate Manager",
      "AWS Cloud Map",
      "Amazon CloudFront",
      "AWS CloudShell",
      "AWS CloudTrail",
      "AmazonCloudWatch",
      "CloudWatch Events",
      "AWS CodeArtifact",
      "CodeBuild",
      "AWS CodeCommit",
      "Amazon Cognito",
      "AWS Config",
      "AWS Cost Explorer",
      "Databricks Lakehouse Platform",
      "Amazon Detective",
      "AWS Directory Service",
      "AWS Database Migration Service",
      "Amazon DynamoDB",
      "Amazon EC2 Container Registry (ECR)",
      "Amazon Elastic Load Balancing",
      "Amazon Elastic Compute Cloud - Compute",
      "Amazon Elastic Block Store",
      "Amazon Elastic Container Service",
      "Amazon Elastic Container Service for Kubernetes",
      "AWS Elastic Disaster Recovery",
      "Amazon Elastic File System",
      "Amazon ElastiCache",
      "Amazon FSx",
      "Amazon Glacier",
      "AWS Global Accelerator",
      "AWS Glue",
      "Amazon GuardDuty",
      "Amazon Inspector",
      "AWS IoT",
      "AWS Key Management Service",
      "Amazon Kinesis",
      "Amazon Kinesis Analytics",
      "Amazon Kinesis Firehose",
      "AWS Lambda",
      "LAMP Stack Ubuntu 20",
      "Amazon Lightsail",
      "Amazon Managed Grafana",
      "Amazon Managed Service for Prometheus",
      "Amazon Managed Streaming for Apache Kafka",
      "Amazon MemoryDB",
      "Amazon MQ"
    ]