AWS
February 11, 2025 ยท View on GitHub
To know how to price each resource it's good to check the AWS Price Calculator and the CSV that we use for AWS has this columns and format.
Adding new resources
- Familiarize yourself with the official AWS pricing page for the service as well as the Terraform documentation for the resource you want to add. Note all factors that influence the cost.
- Download and familiarize yourself with the pricing data CSV. This can be done by first checking the index.json, finding the respective service under the
offerskey and downloading the file at the URL under thecurrentVersionUrl(replacejsonwithcsv). - Find the names of all columns that contain relevant cost factors and check that the
aws/field/field.gofile contains them - add them if this is not the case and also to theaws/ingester.goso it's categorized to the right entity (Price or Product). The constant name should be a correct Go identifier, while the comment should contain the variable name as it appears inaws/field/field.go. - Run
make generateto regenerate the field list. - Create a new file in the
aws/terraformdirectory with the name of the Terraform resource (without theawsprefix), e.g. foraws_db_instanceit would bedb_instance.go. It should include two new structs:Resource(that is an intermediate struct containing only the relevant cost factors) andresourceValues(that directly represents the values from the Terraform resource.) Additionally, theResourcestruct must implement theComponentsmethod that returns[]query.Component. See the other existing resources for inspiration. - Add the terraform resource to the
aws/terraform/provider.goon theResourceComponents - Write tests for your resource. As before, check the other existing test files for inspiration.
- Test and make sure that estimating your resource works.
- Open a PR with the changes and please try to provide as much information as possible, especially: description of all the cost factors that the PR uses, links to Terraform docs and AWS pricing page, examples of a Terraform file and the resulting estimation.
List of supported resources and attributes
aws_instanceaws_autoscaling_groupaws_cloudwatch_log_groupaws_cloudwatch_metric_alarmaws_db_instanceaws_ebs_volumeaws_efs_file_systemaws_elasticache_clusteraws_elasticache_replication_groupaws_eipaws_elbaws_eks_clusteraws_eks_node_groupaws_fsx_lustre_file_systemaws_fsx_ontap_file_systemaws_fsx_openzfs_file_systemaws_fsx_windows_file_systemaws_kms_keyaws_lbaws_albaws_nat_gatewayaws_rds_clusteraws_rds_cluster_instanceaws_s3_bucketaws_s3_bucket_analytics_configurationaws_s3_bucket_inventoryaws_secretsmanager_secretaws_sqs_queue