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.
- 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
offers
key and downloading the file at the URL under thecurrentVersionUrl
(replacejson
withcsv
). - Find the names of all columns that contain relevant cost factors and check that the
aws/field/field.go
file contains them - add them if this is not the case and also to theaws/ingester.go
so 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 generate
to regenerate the field list. - Create a new file in the
aws/terraform
directory with the name of the Terraform resource (without theaws
prefix), e.g. foraws_db_instance
it 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, theResource
struct must implement theComponents
method that returns[]query.Component
. See the other existing resources for inspiration. - Add the terraform resource to the
aws/terraform/provider.go
on 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.
aws_instance
aws_ebs_volume
aws_elasticache_cluster
aws_elasticache_replication_group
aws_eip
aws_db_instance
aws_lb/aws_alb
aws_elb
- Location
- Instance type
- Tenancy - only "shared" and "dedicated"
- Operating system - currently only Linux supported, every instance is treated as a Linux instance
- Pre-installed S/W - currently not supported, the value of "NA" is used instead
- Storage - see more in the
aws_ebs_volume
entry
- Only "On Demand" instances are supported.
- Only compute and storage costs are estimated. GPU, monitoring, etc. are not taken into account.
- Uptime of 730 hours in a month (non-stop) is assumed.
- Location
- Instance class
- Database engine and edition
- License model - "License included" or "Bring your own license"
- Deployment option - "Single-AZ" or "Multi-AZ"
- Allocated storage
- Storage type - "Magnetic" (standard), "Provisioned IOPS" (io1), "General Purpose" (gp2)
- Provisioned IOPS - only for this type of storage; 100 by default
- Only "On Demand" database instances are supported.
- Uptime of 730 hours in a month (non-stop) is assumed.
- Location
- Volume type - "gp2" by default
- Volume size - 8GB by default
- Provisioned IOPS - only for "io1" and "io2" volume types; 100 by default
- Location
- InstanceType
- CacheEngine - "Memcached" or "Redis"
- HourlyQuantity is incresed regarding the number of cache nodes
- Location
- InstanceType
- CacheEngine - "Memcached" or "Redis"
- HourlyQuantity is incresed regarding the number of cache nodes
- Group - IdleAddress by default
- StartingRange - 1 by default
- Location
- Load balancer type - "application" by default
- Cost of Load Balancer Capacity Units (LCU's) per hour is not estimated.
- Location
- Data transfer usage cost is not estimated.