Agent Wranglers

INF-88Recommended

Track cloud quotas before they block a scale-up

List the account quotas that the planned peak and a full rebuild would use, such as instances, CPUs, addresses and load balancers. Alert at 80% of each, and ask for raises before a launch.

How to do it

Cloud accounts start with low limits on servers, CPUs per family, public addresses, load balancers and database instances. Autoscaling that hits one fails quietly, and a rebuild in a new region may hit them all at once. Read current use and limits from the provider, such as AWS Service Quotas or the Google Cloud quotas page, and alarm on the ratio. Raises can take days, so ask before a known peak, as Scale up before a peak you know is coming says. Check the same limits in the account that the exit plan would move to. Platform limits for functions and builds are in Test the service against every platform limit.

Examples

Shell example

# AWS: running on-demand standard vCPUs limit in this region
aws service-quotas get-service-quota --service-code ec2 --quota-code L-1216C47A --query 'Quota.Value'

Terraform example

resource "aws_cloudwatch_metric_alarm" "vcpu_quota" {
  alarm_name          = "ec2-standard-vcpu-80-percent"
  comparison_operator = "GreaterThanThreshold"
  evaluation_periods  = 1
  threshold           = 80
  metric_query {
    id          = "usage_percent"
    expression  = "(usage / SERVICE_QUOTA(usage)) * 100"
    return_data = true
  }
  metric_query {
    id = "usage"
    metric {
      namespace   = "AWS/Usage"
      metric_name = "ResourceCount"
      period      = 300
      stat        = "Maximum"
      dimensions  = { Service = "EC2", Resource = "vCPU", Type = "Resource", Class = "Standard/OnDemand" }
    }
  }
}

How to check

A list in the repository names every quota the autoscaling maximum and a full rebuild use, with the value each needs. Each quota has an alarm at 80%. Every needed value is below the account's current limit.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/infrastructure/hosting-platforms/cloud-quotas">Agent Wranglers infrastructure and environments playbook</a>. In code you write, add a comment next to it with the same link.