Usage and Configuration-Based Cost Estimation

Governance supports cost estimation based on the Terraform Configuration.

It can also give cost-estimations based on supplementary input parameters for a resource (it is optional). These parameters could be usage or configuration based and enable us to generate customized cost estimates based on anticipated usage.

Terraform/Terragrunt

For repositories utilizing Terraform or Terragrunt, these inputs can be specified through a configuration file in JSON format named usage.json (located in the same terraform working directory configured for the deployment):

Example of usage.json

{ 

  "version": "0.1", 

  "resource_usage": { 

    "aws_instance.costguard_demo_ec2_1": { 

      "os": "linux_unix" 

    }, 

    "aws_instance.costguard_demo_ec2_2": { 

      "term_type": "compute_savings_plan", 

      "purchase_option": "partial_upfront", 

      "lease_contract_length": "3yr" 

    } 

  } 

} 
Key Description
Example: “aws_instance.costguard_demo_ec2_1” Resource Description
“os” Resource Property
"linux_unix" The value being set
version: "0.1" # Version of the schema 

resource_usage: # All resource usage values should be listed here 

  # The resource is identified as <terraform_resource_name>.<resource_identifier> 

  aws_instance.costguard_demo_ec2: 

    # Each field represents a specific attribute and its expected usage 

    # <attribute_field_name>:<expected_value> 

    os: "linux_unix" 

  aws_instance.costguard_demo_ec2_2: 

    term_type: "compute_savings_plan" 

    purchase_option: "partial_upfront" 

    lease_contract_length: "3yr" 

Estimates are displayed as PR comments, providing insights into monthly costs based on usage inputs.

Current list of supported service types:

  1. EC2

  2. EBS
  3. ElasticMapReduce (EMR)
  4. S3
  5. RDS
  6. ElasticCache
  7. DynamoDB
  8. Lambda
  9. SNS
  10. SQS
  11. SecretManager
  12. EventBridge
  13. VPC
  14. RedShift
  15. Cloudwatch
  16. Key Management Service (KMS)
  17. FSx

Usage Input details per service type

Compute Resources

aws_instance

count:  

  desc: Number of instances to launch  

term_type:  

  values: ["compute_savings_plan", "ec2_savings_plan", "standard_reserved_instance", "convertible_reserved_instance"]  

  desc: Type of pricing model  

purchase_option:  

  values: ["all_upfront", "partial_upfront", "no_upfront"]  

  desc: Payment option for reserved instances  

lease_contract_length:  

  values: ["1yr", "3yr"] or ["1_year", "3_year"]  

  desc: Duration of lease in years  

aws_launch_template

count:  

  desc: Number of instances to launch  

term_type:  

  values: "reserved" or "on_demand"  

  desc: Type of pricing model  

purchase_option:  

  values: ["all_upfront", "partial_upfront", "no_upfront"]  

  desc: Payment option for reserved instances  

lease_contract_length:  

  values: ["1yr", "3yr"] or ["1_year", "3_year"]  

  desc: Duration of lease in years 

Database Resources

aws_db_instance

term_type:  

  values: "reserved" or "on_demand"  

  desc: Type of pricing model  

purchase_option:  

  values: ["all_upfront", "partial_upfront", "no_upfront"]  

  desc: Payment option for reserved instances  

lease_contract_length:  

  values: "1" or "3"  

  desc: Duration of lease in years 

aws_rds_cluster

acu_per_hour:  

  desc: Aurora Capacity Units per hour for Aurora Serverless V2  

aurora_storage_gb:  

  desc: Amount of Aurora storage in GB for Aurora Serverless V2  

aws_dynamobd_table

storage_gb:  

  desc: Amount of data stored in the table in GB  

strongly_consistent_reads_per_month:  

  desc: Number of strongly consistent read requests per month  

eventually_consistent_reads_per_month:  

  desc: Number of eventually consistent read requests per month  

transaction_reads_per_month:  

  desc: Number of transactional read requests per month  

standard_writes_per_month:  

  desc: Number of standard write requests per month  

transaction_writes_per_month:  

  desc: Number of transactional write requests per month  

average_item_byte_size:  

  desc: Average size of items stored in bytes

aws_elasticache_cluster, aws_elasticache_replication_group

term_type:  

  values: "reserved" or "on_demand"  

  desc: Type of pricing model  

purchase_option:  

  values: ["all_upfront", "partial_upfront", "no_upfront", "heavy_utilization"]  

  desc: Payment option for reserved instances  

lease_contract_length:  

  values: "1" or "3"  

  desc: Duration of lease in years  

aws_redshift_cluster

term_type:  

  values: "on_demand" , "reserved" 

  desc: Type of pricing model  

backup_storage_gb:  

  desc: Backup storage beyond included amount in GB  

spectrum_data_scanned_tb:  

  desc: Amount of data scanned by Redshift Spectrum in TB  

managed_storage_gb:  

  desc: Amount of managed storage in GB  

data_transfer_gb:  

  desc: Amount of data transferred in GB  

utilization_hours:  

  desc: Number of hours the cluster is utilized per month  

Storage Resources

aws_ebs_volume

count:  

  desc: Number of volumes to create  

iops:  

  desc: Provisioned IOPS (only for io1, io2 volume types)  

throughput:  

  desc: Throughput in MiB/s (only for gp3 volume type)  

aws_fsx_lustre_file_system

compression_factor:  

  desc: Data compression ratio for storage optimization  

backup_storage_gb:  

  desc: Amount of backup storage in GB  

aws_s3_bucket

standard_storage: 

  storage_gb:  

    desc: Amount of data stored in standard storage class in GB  

  rw_requests:  

    desc: Number of read-write API requests per month for standard storage  

  ro_requests:  

    desc: Number of read-only API requests per month for standard storage  

standard_ia_storage: 

  storage_gb:  

    desc: Amount of data stored in standard IA storage class in GB  

  rw_requests:  

    desc: Number of read-write API requests per month for standard IA storage  

  ro_requests:  

    desc: Number of read-only API requests per month for standard IA storage  

Messaging Resources

aws_sns_topic

monthly_requests:  

  desc: Number of API requests per month  

monthly_storage:  

  desc: Amount of data stored for message archive in GB

aws_sns_topic_subscription

monthly_notifications:  

  desc: Number of notifications delivered per month  

aws_sqs_queue

monthly_notifications:  

  desc: Number of notifications delivered per month  

Serverless Resources

aws_lambda_function

monthly_requests:  

  desc: Number of function invocations per month  

request_duration_ms:  

  desc: Average duration of each invocation in milliseconds  

aws_lambda_provisioned_concurrency_config

monthly_requests:  

  desc: Number of function invocations per month  

request_duration_ms:  

  desc: Average duration of each invocation in milliseconds  

Big Data Resources

aws_emrserverless_application

job_runtime_hour:  

  desc: Number of hours the EMR Serverless application runs  

aws_emrcontainers_job_template

job_runtime_hour:  

  desc: Number of hours the EMR Containers job runs  

job_vcpu:  

  desc: Number of vCPUs allocated to the job  

job_memory_gb:  

  desc: Amount of memory allocated to the job in GB  

Event Processing Resources

aws_schemas_schema

ingestion_count:  

  desc: Number of schema ingestion operations per month  

aws_pipes_pipe

event_count:  

  desc: Number of events processed through the pipe per month  

aws_cloudwatch_event_bus

event_count:  

  desc: Number of events processed through the event bus per month  

aws_cloudwatch_event_archive

archive_processing:  

  desc: Amount of data processed for archiving in GB  

archive_storage:  

  desc: Amount of archived data stored in GB  

Monitoring Resources

aws_cloudwatch_metric_alarm

avg_metrics_retrieved:  

  desc: Average number of metrics retrieved per alarm per month  

Security Resources

aws_secretsmanager_secret

monthly_requests:  

  desc: Number of API requests per month  

aws_kms_key

monthly_symmetric_requests:  

  desc: Number of symmetric encryption/decryption requests per month  

monthly_asymmetric_requests_except_rsa2048:  

  desc: Number of asymmetric requests per month (excluding RSA 2048)  

monthly_asymmetric_rsa2048_requests:  

  desc: Number of RSA 2048 asymmetric requests per month  

monthly_generatedatakeypair_ecc_requests:  

  desc: Number of ECC key pair generation requests per month  

monthly_generatedatakeypair_rsa_requests:  

  desc: Number of RSA key pair generation requests per month  

aws_kms_external_key

monthly_symmetric_requests:  

  desc: Number of symmetric encryption/decryption requests per month  

monthly_asymmetric_requests_except_rsa2048:  

  desc: Number of asymmetric requests per month (excluding RSA 2048)  

monthly_asymmetric_rsa2048_requests:  

  desc: Number of RSA 2048 asymmetric requests per month  

monthly_generatedatakeypair_ecc_requests:  

  desc: Number of ECC key pair generation requests per month  

monthly_generatedatakeypair_rsa_requests:  

  desc: Number of RSA key pair generation requests per month  
aws_kms_replica_key
monthly_symmetric_requests:  

  desc: Number of symmetric encryption/decryption requests per month  

monthly_asymmetric_requests_except_rsa2048:  

  desc: Number of asymmetric requests per month (excluding RSA 2048)  

monthly_asymmetric_rsa2048_requests:  

  desc: Number of RSA 2048 asymmetric requests per month  

monthly_generatedatakeypair_ecc_requests:  

  desc: Number of ECC key pair generation requests per month  

monthly_generatedatakeypair_rsa_requests:  

  desc: Number of RSA key pair generation requests per month  

aws_kms_replica_external_key

monthly_symmetric_requests:  

  desc: Number of symmetric encryption/decryption requests per month  

monthly_asymmetric_requests_except_rsa2048:  

  desc: Number of asymmetric requests per month (excluding RSA 2048)  

monthly_asymmetric_rsa2048_requests:  

  desc: Number of RSA 2048 asymmetric requests per month  

monthly_generatedatakeypair_ecc_requests:  

  desc: Number of ECC key pair generation requests per month  

monthly_generatedatakeypair_rsa_requests:  

  desc: Number of RSA key pair generation requests per month  

Networking Resources

aws_nat_gateway

data_transfer_month_gb:  

  desc: Amount of data processed through NAT gateway in GB per month  

aws_vpn_connection

data_processing_month_gb:  

  desc: Amount of data processed through VPN connection in GB per month  

aws_ec2_transit_gateway_vpc_attachment

data_processing_month_gb:  

  desc: Amount of data processed through transit gateway in GB per month  

aws_ec2_client_vpn_network_association

active_users:  

  desc: Number of concurrent VPN users  

hrs_active_per_month:  

  desc: Number of hours the VPN connection is active per month