{"id":13820042,"url":"https://github.com/terraform-aws-modules/terraform-aws-pricing","last_synced_at":"2026-02-04T12:10:44.142Z","repository":{"id":37625076,"uuid":"331612826","full_name":"terraform-aws-modules/terraform-aws-pricing","owner":"terraform-aws-modules","description":"Terraform module which calculates price of AWS infrastructure (from Terraform state and plan) 🇺🇦","archived":false,"fork":false,"pushed_at":"2024-10-11T16:11:29.000Z","size":100,"stargazers_count":195,"open_issues_count":0,"forks_count":48,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-01-30T12:41:09.427Z","etag":null,"topics":["aws","aws-pricing","aws-pricing-api","aws-pricing-terraform","cost-estimation","pricing","terraform-cost-estimation","terraform-module"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/modules/terraform-aws-modules/pricing/aws","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terraform-aws-modules.png","metadata":{"funding":{"github":["antonbabenko"],"custom":"https://www.paypal.me/antonbabenko"},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-21T11:54:44.000Z","updated_at":"2025-12-27T01:43:46.000Z","dependencies_parsed_at":"2024-08-13T20:57:04.457Z","dependency_job_id":"495cdf6f-5f93-4ccc-b868-f162b2abad04","html_url":"https://github.com/terraform-aws-modules/terraform-aws-pricing","commit_stats":{"total_commits":29,"total_committers":10,"mean_commits":2.9,"dds":0.6551724137931034,"last_synced_commit":"719da5e2557867c2eef31ce6fbe724348abc9ea0"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/terraform-aws-modules/terraform-aws-pricing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-pricing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-pricing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-pricing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-pricing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terraform-aws-modules","download_url":"https://codeload.github.com/terraform-aws-modules/terraform-aws-pricing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-pricing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29084092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-04T03:31:03.593Z","status":"ssl_error","status_checked_at":"2026-02-04T03:29:50.742Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-pricing","aws-pricing-api","aws-pricing-terraform","cost-estimation","pricing","terraform-cost-estimation","terraform-module"],"created_at":"2024-08-04T08:00:57.526Z","updated_at":"2026-02-04T12:10:44.127Z","avatar_url":"https://github.com/terraform-aws-modules.png","language":"HCL","funding_links":["https://github.com/sponsors/antonbabenko","https://www.paypal.me/antonbabenko"],"categories":["HCL"],"sub_categories":[],"readme":"# Terraform AWS pricing module\n\nTerraform module, which calculates the AWS infrastructure cost in a variety of ways. This is not a _traditional_ Terraform module because it does not create AWS infrastructure resources but using Terraform plan and Terraform states as input.\n\n`cost.modules.tf` is entirely free cost estimation service, which is part of [modules.tf](https://modules.tf) that is currently in active development.\n\nJoin the mailing list on [modules.tf](https://modules.tf) to stay updated!\n\nIf you are looking into alternative ways calculating AWS infrastructure costs (for free), you can use [terraform-cost-estimation.com](https://www.terraform-cost-estimation.com) or [terraform-cost-estimation](https://github.com/antonbabenko/terraform-cost-estimation).\n\nThis is not an official HashiCorp product.\n\n## Supported Features\n\n- Calculate costs before creation (tfplan)\n- Calculate costs after creation (tfstate)\n- Calculate costs from multiple sources (local, remote states, specified resources)\n- Optionally, using [cost.modules.tf](https://cost.modules.tf/)\n- Can be executed on restricted CI/CD platforms where Terraform can run\n\n## Supported Resources\n\n- EC2 instances (on-demand) and Autoscaling Groups (Launch Configurations and Launch Templates):\n  - aws_instance\n- EBS Volumes, Snapshots, Snapshot Copies\n  - aws_ebs_volume\n  - aws_ebs_snapshot\n  - aws_ebs_snapshot_copy\n- Elastic Load Balancing (ELB, ALB, NLB)\n  - aws_elb\n  - aws_alb / aws_lb\n- NAT Gateways\n  - aws_nat_gateway\n- Redshift Clusters\n  - aws_redshift_cluster\n\n## Feature Roadmap\n\n- More EC2 instances (on-demand) and Autoscaling Groups (Launch Configurations and Launch Templates)\n  - aws_autoscaling_group\n  - aws_launch_configuration\n  - aws_launch_template\n- EC2 Fleets (on-demand)\n  - aws_ec2_fleet\n\n## Usages\n\n### Using AWS Pricing API: Terraform state or plan as JSON\n\n```hcl\nprovider \"aws\" {\n  region = \"us-east-1\"\n}\n\nmodule \"pricing\" {\n  source = \"terraform-aws-modules/pricing/aws//modules/pricing\"\n\n  # content can be Terraform state or plan as JSON fetched from any source (see examples)\n  content = jsondecode(\"{\\\"version\\\": 4, \\\"terraform_version\\\": \\\"0.14.4\\\", ...\")\n}\n```\n\n### Using AWS Pricing API: Terraform plan as JSON from local file\n\n```hcl\nprovider \"aws\" {\n  region = \"us-east-1\"\n}\n\ndata \"local_file\" \"local_plan\" {\n  filename = \"local_plan.json\"\n}\n\nmodule \"pricing\" {\n  source = \"terraform-aws-modules/pricing/aws//modules/pricing\"\n\n  content = jsondecode(data.local_file.local_plan.content)\n}\n```\n\n### Using AWS Pricing API: Specified resources\n\n```hcl\nprovider \"aws\" {\n  region = \"us-east-1\"\n}\n\nmodule \"pricing\" {\n  source = \"terraform-aws-modules/pricing/aws//modules/pricing\"\n\n  resources = {\n    \"aws_instance.this#5\" = { # Note: This means 5 instances (`count = 5`)\n      instanceType = \"c5.xlarge\"\n      location     = \"eu-west-2\"\n    }\n    \"aws_instance.this2\" = {\n      instanceType = \"c4.xlarge\"\n      location     = \"eu-central-1\"\n    }\n  }\n}\n```\n\n### Run in automation\n\n@todo: Describe in more details...\n\n```shell\n# Project1 (with real EC2 resources):\nterraform plan -out=plan.tfplan \u003e /dev/null \u0026\u0026 terraform show -json plan.tfplan \u003e plan.json\n\n# Project2 (terraform-aws-pricing module):\nTF_VAR_file_path=plan.json terraform apply\nHOURLY_PRICE=$(terraform output -raw total_price_per_hour)\n\nif HOURLY_PRICE \u003c 10 then\n  terraform apply plan.json # (from Project1)\nelse\n  echo \"Crash! Boom! Bang!\"\nend\n```\n\n### Notes\n\n#### AWS provider\n\nSet AWS provider's region to `us-east-1`, `ap-south-1` or `eu-central-1` when using [modules/pricing](https://github.com/terraform-aws-modules/terraform-aws-pricing/tree/master/modules/pricing) because AWS Pricing service is only available in these regions.\n\nYou can also pass provider explicitly as described in the [official documentation](https://www.terraform.io/docs/modules/providers.html#passing-providers-explicitly).\n\n\n#### Debug \u0026 development tips\n\n1. `debug_output = true` will return more output which is often helpful only for development and debug purposes.\n\n2. `call_aws_pricing_api = false` will not call AWS Pricing API. Wrong filters produce a lot of noise, so it makes sense to disable this option when developing new filters.\n\n3. AWS Pricing API should always return one response for the filter. Running these commands can help identify available filters to put into `modules/pricing/filters.tf` (see `dev` directory also):\n\n    \u003e aws pricing describe-services --service-code AmazonEC2 --format-version aws_v1 --max-items 1 --region us-east-1\n\n    \u003e aws pricing get-products --region us-east-1 --filters file://filters.json --format-version aws_v1 --service-code AmazonEC2\n\n\n#### Ephemeral Terraform backend\n\nSometimes, you may want to not store Terraform state in backend when dealing with pricing, you can use backend \"inmem\":\n\n```hcl\nterraform {\n  backend \"inmem\" {}\n}\n```\n\nWhen you use this type of backend, there is no way to run `terraform output`.\n\n\n### Known issues/limitations\n\n1. Autoscaling groups resources\n1. When changing values price is sometimes higher after the first run because it is calculated based on keys and there can be some previous keys. Solution is to update code to include some unique key/prefix. Or just disable terraform state (no state = no past).\n1. At some point later, maybe add support for other providers like [Azure](http://davecallan.com/azure-price-api-examples/) and [Google Cloud](https://stackoverflow.com/questions/59048071/how-to-get-gcp-pricing-list-from-catalogue-api)\n\n\n## Examples\n\n* [Cost estimation using cost.modules.tf service](https://github.com/terraform-aws-modules/terraform-aws-pricing/tree/master/examples/cost-modules-tf)\n* [Terraform state/plan cost estimation using AWS Pricing API](https://github.com/terraform-aws-modules/terraform-aws-pricing/tree/master/examples/pricing-terraform-state-and-plan)\n* [Complete example using AWS Pricing API](https://github.com/terraform-aws-modules/terraform-aws-pricing/tree/master/examples/complete) - Get cost estimation for multiple sources combined.\n* [Specified resources using AWS Pricing API](https://github.com/terraform-aws-modules/terraform-aws-pricing/tree/master/examples/pricing-resources) - Get cost estimation for specified resources.\n\n\n\u003c!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n\n\u003c!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n\n## Authors\n\nModule created and managed by [Anton Babenko](https://github.com/antonbabenko).\n\nPlease reach out to [Betajob](https://www.betajob.com/) if you are looking for commercial support for your Terraform, AWS, or serverless project.\n\n\n## License\n\nApache 2 Licensed. See LICENSE for full details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraform-aws-modules%2Fterraform-aws-pricing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterraform-aws-modules%2Fterraform-aws-pricing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraform-aws-modules%2Fterraform-aws-pricing/lists"}