IaC Cost Patterns

A collection of patterns and antipatterns for managing cost in IaC files.

Antipattern: Expensive monitoring

Monitoring solutions are expensive and might not be needed.

Context

Cloud providers offer ways to monitor deployed infrastructure and collect metrics and logs. These solutions add cost for e.g. health checks and log storage, and the benefits may not outweigh this cost.

Solution

Removing monitoring or logs for noncritical infrastructure is an effective way to save cost.

Example

Remove a Route 53 health check for a private Plex instance to save costs:

@@ -1,6 +0,0 @@
-resource "aws_route53_health_check" "example" {
-  fqdn = "plex.example.com"
-  port = 443
-  request_interval = "30"
-  failure_threshold = "5"
-}

References

Occurrences

Terraform

AWS CloudFormation