A collection of patterns and antipatterns for managing cost in IaC files.
Use budgets to receive alerts about charged and forecasted costs and control spending.
Use spot instances to run interruptible workloads for significant cost savings compared to regular instances.
Define lifecycle rules for object storage to move objects to cheaper storage or drop them entirely.
Compute instances are often overprovisioned even when a cheaper instance would suffice.
Using newer resource generations gives similar performance for lower cost.
More expensive storage types are often used even when cheaper storage types would be sufficient.
Network resources like NAT gateways, elastic IP addresses and subnets tend to be expensive while not being strictly needed.
Resources like RAM, storage and CPU utilization are often overprovisioned even when lower values are acceptable.
AWS DynamoDB tables often use features that carry cost but are not required, especially for infrequently accessed tables.
Monitoring solutions are expensive and might not be needed.
Cost report elements can be used to obtain information on the actual spendings over a period of time.
Templates with predefined configurations that enforce cost-optimizing methods can proactively manage and reduce future expenses.