Inferensys

Prompt

Auto-Scaling Policy Design Prompt

A practical prompt playbook for using Auto-Scaling Policy Design Prompt in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Define the specific job this prompt performs, the ideal user, required context, and the boundaries where it should not be applied.

This prompt is designed for Site Reliability Engineers (SREs) and cloud engineers who need to produce a rigorous, production-ready auto-scaling policy specification. The job-to-be-done is translating a service's traffic pattern, performance constraints, and cost tolerance into a concrete set of scale-out triggers, scale-in cooldowns, metric selections, and over-provisioning guardrails. The ideal user brings a deep understanding of the target workload's behavior, including its initialization latency, statefulness, and downstream dependency limits, and needs a structured output that can be directly reviewed and translated into infrastructure-as-code configurations like AWS Auto Scaling groups, Kubernetes HorizontalPodAutoscalers, or Terraform modules.

Use this prompt when you are designing a new scaling policy from scratch or auditing an existing one for oscillation risk and cold-start latency. It is most effective when you can provide concrete context: the target metric (CPU, memory, custom metrics like request queue depth), the expected traffic envelope (steady state, diurnal peaks, and known flash-mob events), the service's boot time, and any hard limits on maximum instance count driven by cost or quota. The prompt forces explicit reasoning about the interaction between scale-out aggressiveness and scale-in caution, which is the primary source of production instability. Do not use this prompt for simple static provisioning decisions, for services with entirely predictable batch workloads that don't require dynamic scaling, or as a substitute for load testing. The output is a design document, not a real-time controller; it must be tested against simulated traffic before production deployment.

After generating the policy specification, the next step is to validate it against historical metrics and failure injection scenarios. Pay particular attention to the prompt's output on 'oscillation risk'—the most common production failure mode is a policy that scales out too quickly in response to a transient spike and then scales in too quickly during the cooldown, creating a costly and destabilizing cycle. The guardrails section of the output should be directly translated into maximum and minimum instance counts in your orchestration system. If the prompt identifies a conflict between cost constraints and latency SLOs, resolve that conflict with human judgment before implementing the policy; the model can surface the trade-off but cannot make the business decision.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works for designing auto-scaling policies and where it introduces risk. Use these cards to decide if the prompt fits your current infrastructure task.

01

Good Fit: Greenfield Policy Design

Use when: You are designing a new auto-scaling policy for a well-understood workload with available historical metrics. The prompt excels at generating a structured specification covering scale-out triggers, scale-in cooldowns, and metric selection from scratch. Guardrail: Always validate the generated policy against at least one week of historical metric data before deployment.

02

Bad Fit: Real-Time Traffic Tuning

Avoid when: You need to adjust scaling parameters in response to an ongoing incident or live traffic surge. The prompt produces a static design document, not a dynamic control loop. Guardrail: Pair this prompt with a runbook generation workflow for incident response. The policy design is a planning artifact, not an operational dashboard.

03

Required Input: Metric Baseline

Risk: The prompt cannot infer your application's latency profile, throughput patterns, or resource utilization without explicit input. A policy designed on assumptions will oscillate or under-provision. Guardrail: Provide concrete metric names, target values, and a description of diurnal traffic patterns in the [INPUT] context. Vague inputs produce dangerous outputs.

04

Required Input: Infrastructure Constraints

Risk: The prompt may recommend scaling boundaries that exceed your account limits, available instance types, or regional capacity. A policy that scales beyond your quotas will fail silently until traffic hits. Guardrail: Include explicit maximum instance counts, preferred instance families, and regional constraints in the [CONSTRAINTS] block. The model cannot read your cloud account.

05

Operational Risk: Oscillation

Risk: Poorly tuned scale-in cooldowns or aggressive scale-out thresholds can cause flip-flopping, where instances are added and removed in rapid cycles, degrading performance and increasing cost. Guardrail: Use the prompt's built-in eval criteria for oscillation risk. After generation, simulate the policy against a sawtooth traffic pattern to confirm dampening behavior before production rollout.

06

Operational Risk: Cold-Start Latency

Risk: A policy that scales on CPU alone may add instances too late for traffic spikes if application startup time is significant. Users will experience latency before new instances are ready. Guardrail: Include application startup time in the [INPUT] context and request a pre-warming or step-scaling strategy in the [CONSTRAINTS]. Validate the generated policy against a cold-start latency budget.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for generating a structured auto-scaling policy specification with placeholders for workload context, metrics, and operational constraints.

The following prompt template is designed to produce a complete auto-scaling policy specification from a description of your workload, infrastructure, and operational requirements. It forces the model to reason about scale-out triggers, scale-in cooldowns, metric selection, and over-provisioning guardrails before generating the final output. Use this template as the starting point for your own implementation, replacing each square-bracket placeholder with concrete values from your environment.

text
You are an SRE architect specializing in cloud auto-scaling policy design. Your task is to produce a complete, implementation-ready auto-scaling policy specification based on the provided workload context.

## WORKLOAD CONTEXT
[WORKLOAD_DESCRIPTION]

## INFRASTRUCTURE DETAILS
- Compute platform: [COMPUTE_PLATFORM]
- Current instance/container specifications: [INSTANCE_SPECS]
- Orchestration layer: [ORCHESTRATION_TOOL]
- Target region(s): [REGIONS]

## CONSTRAINTS
- Maximum allowed instance count: [MAX_INSTANCES]
- Minimum required instance count: [MIN_INSTANCES]
- Cost budget constraints: [COST_CONSTRAINTS]
- Cold-start latency tolerance (seconds): [COLD_START_TOLERANCE]
- Regulatory or compliance requirements: [COMPLIANCE_REQUIREMENTS]

## AVAILABLE METRICS
[List the metrics available for scaling decisions, e.g., CPU utilization, request latency p95, queue depth, custom application metrics]
[METRICS_LIST]

## OUTPUT SCHEMA
Produce a JSON object with the following structure:
{
  "policy_name": "string",
  "version": "string",
  "scale_out": {
    "triggers": [
      {
        "metric": "string",
        "threshold": "number",
        "duration_seconds": "number",
        "cooldown_seconds": "number",
        "increment_type": "fixed_or_percent",
        "increment_value": "number"
      }
    ],
    "stabilization_window_seconds": "number"
  },
  "scale_in": {
    "triggers": [
      {
        "metric": "string",
        "threshold": "number",
        "duration_seconds": "number",
        "cooldown_seconds": "number",
        "decrement_type": "fixed_or_percent",
        "decrement_value": "number"
      }
    ],
    "stabilization_window_seconds": "number"
  },
  "over_provisioning_guardrails": {
    "max_headroom_percent": "number",
    "predictive_scaling_enabled": "boolean",
    "schedule_overrides": [
      {
        "cron_expression": "string",
        "min_instances": "number",
        "reason": "string"
      }
    ]
  },
  "oscillation_prevention": {
    "hysteresis_margin_percent": "number",
    "minimum_steady_state_duration_seconds": "number",
    "flapping_detection_window_seconds": "number",
    "max_scale_events_per_window": "number"
  },
  "failure_modes": [
    {
      "scenario": "string",
      "detection": "string",
      "mitigation": "string"
    }
  ],
  "assumptions": ["string"],
  "risks": ["string"]
}

## EVALUATION CRITERIA
Before finalizing the policy, verify:
1. Scale-out triggers activate before user-facing degradation occurs.
2. Scale-in cooldowns prevent premature termination during traffic dips.
3. Oscillation prevention mechanisms are sufficient for the workload's traffic pattern volatility.
4. Cold-start latency is accounted for in stabilization windows.
5. Over-provisioning guardrails prevent cost runaway without sacrificing availability.
6. At least two distinct failure modes are identified with detection and mitigation steps.

## INSTRUCTIONS
1. Analyze the workload description and identify the dominant scaling signals.
2. Select the most appropriate metrics from the available list; explain why any were excluded.
3. Design scale-out and scale-in triggers with specific thresholds justified by the workload context.
4. Configure cooldowns and stabilization windows that account for cold-start latency.
5. Add oscillation prevention parameters appropriate to the traffic pattern.
6. Identify at least two failure modes specific to this workload.
7. Output ONLY the JSON object. No explanatory text outside the JSON.

To adapt this template for your own use, replace each bracketed placeholder with concrete values from your environment. The [WORKLOAD_DESCRIPTION] should include traffic patterns, request characteristics, statefulness, and any known scaling anomalies. The [METRICS_LIST] should enumerate only metrics your observability stack actually exposes—do not invent metrics the system cannot measure. If your platform does not support predictive scaling or schedule overrides, remove those fields from the output schema rather than leaving them with placeholder values. For high-risk production workloads, add a human approval step before the generated policy is applied to any environment.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Auto-Scaling Policy Design Prompt. Each placeholder must be populated with concrete values before the prompt can produce a reliable policy specification.

PlaceholderPurposeExampleValidation Notes

[WORKLOAD_TYPE]

Defines the compute pattern to scale: stateless web, stateful queue worker, batch job, or streaming pipeline

stateless-web-api

Must match one of: stateless-web-api, stateful-queue-worker, batch-job, streaming-pipeline. Reject unknown values.

[CURRENT_METRICS]

Provides the available monitoring signals for scaling decisions: CPU, memory, request latency, queue depth, custom metrics

cpu_utilization_p50, request_latency_p99, queue_depth

Each metric must include aggregation function and percentile. Null allowed if no metrics exist yet.

[TRAFFIC_PATTERN]

Describes the expected load shape: steady, diurnal, spiky-event-driven, or unpredictable

diurnal-with-weekend-dip

Must match one of: steady, diurnal, spiky-event-driven, unpredictable. Determines cooldown aggressiveness.

[INSTANCE_STARTUP_TIME]

Specifies how long a new instance takes from launch to ready-to-serve in seconds

45

Must be a positive integer. Values over 120 should trigger cold-start latency warnings in output.

[MAX_INSTANCES]

Hard upper bound on instance count for cost guardrail and quota protection

20

Must be a positive integer. Output must include over-provisioning guardrail logic that respects this ceiling.

[MIN_INSTANCES]

Minimum instance count to maintain for baseline availability

2

Must be a positive integer. Must be less than [MAX_INSTANCES]. Scale-in policy must never breach this floor.

[COST_CONSTRAINT]

Budget or cost-per-hour limit that scaling policy must respect

max $12.50 per hour

String describing constraint. Output must include cost-aware scaling notes if this field is populated. Null allowed.

[REGULATORY_REQUIREMENT]

Any compliance or data residency constraints affecting scaling decisions

data-must-stay-in-eu-west-1

String or null. If populated, output must include region-affinity constraints in scaling rules. Null allowed.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Auto-Scaling Policy Design Prompt into an application or operational workflow.

This prompt is designed to be integrated into a platform engineering or SRE workflow where infrastructure as code (IaC) and observability data are the primary inputs. The implementation harness should treat the LLM as a policy drafting engine, not an autonomous controller. The generated policy specification must pass through a validation layer that checks for structural completeness, metric existence, and threshold sanity before it can be applied to a Terraform module, CloudFormation stack, or Kubernetes HPA manifest. The harness should assemble the prompt context from live data sources: pull current CPU/memory utilization from CloudWatch or Prometheus, extract latency percentiles from your APM, and inject the target resource's constraints from your IaC repository. This ensures the prompt reasons over real data rather than hypotheticals.

The integration pipeline should follow a validate → simulate → approve → apply pattern. After the LLM returns the policy specification, a deterministic validator must check that every referenced metric (e.g., CPUUtilization, RequestCountPerTarget) exists in your monitoring system and that scale-in cooldowns are not shorter than your application's graceful shutdown period. Next, run the proposed policy through a lightweight simulation using historical traffic patterns to detect oscillation risk—if the scale-out threshold triggers a scale-in within the cooldown window more than 10% of the time in simulation, flag the policy for human review. The harness should log the full prompt, raw LLM response, validation results, and simulation outcome to an audit trail before any apply step. For model choice, prefer a model with strong structured output support (e.g., GPT-4o, Claude 3.5 Sonnet) and set response_format to json_schema using the output schema defined in this playbook. Implement a retry wrapper with up to 3 attempts if the output fails schema validation, appending the validation error to the retry prompt.

Do not wire this prompt directly to an auto-apply pipeline. The output is a design artifact that requires a human or an approval workflow to sign off before infrastructure changes are made. A dangerous failure mode is a policy that looks structurally valid but contains a scale-out threshold set to 10% CPU, causing constant flapping and cost overruns. Your harness should include a cost-impact estimator that projects the maximum instance count under the proposed policy against current traffic patterns and flags any projection exceeding a configurable budget threshold. For teams using OpenPolicyAgent or similar policy-as-code frameworks, the harness can translate the LLM output into a Rego rule that gates the Terraform apply, ensuring no scaling policy reaches production without passing the validation and simulation checks.

PRACTICAL GUARDRAILS

Common Failure Modes

Auto-scaling policies fail silently in production. These are the most common failure modes and the practical guardrails to catch them before they cause an outage.

01

Metric-Target Mismatch

What to watch: The scaling metric (e.g., CPU) does not correlate with the actual bottleneck (e.g., connection pool exhaustion). The policy scales the wrong resource while the real constraint degrades. Guardrail: Validate metric selection against a load test that saturates each candidate bottleneck independently. Document the evidence linking the chosen metric to user-facing latency or error rate.

02

Flapping and Oscillation

What to watch: Scale-out adds instances, metric drops below the scale-in threshold, instances are removed, metric spikes again. The system oscillates rapidly, wasting compute and causing instability. Guardrail: Enforce a scale-in cooldown that is at least 3x the instance warm-up time. Add a stabilization window that requires the metric to stay below the threshold for multiple consecutive evaluation periods before scaling in.

03

Cold-Start Latency Amplification

What to watch: New instances take 60-120 seconds to become healthy, but the scaling policy triggers every 60 seconds. Traffic is routed to unready instances, causing request failures that trigger more scale-out events in a cascade. Guardrail: Set the scale-out evaluation period to be longer than the measured 95th-percentile cold-start time. Use lifecycle hooks to delay traffic until the application signals readiness, not just container start.

04

Missing Scale-In Protection

What to watch: A scale-in event terminates an instance mid-request, dropping in-flight transactions and corrupting state for stateful workloads. Guardrail: Implement connection draining with a deregistration delay that exceeds the longest expected request duration. For stateful workloads, require a shutdown lifecycle hook that completes in-flight work before termination. Never scale in without draining.

05

Ceiling Without Alerting

What to watch: The policy hits the maximum instance limit but demand continues to rise. The system saturates silently because the scaling metric stays high but no action is taken. Guardrail: Create an alert that fires when the instance count equals the maximum and the scaling metric remains above the scale-out threshold for more than two evaluation periods. This is a capacity signal, not a scaling signal.

06

Downstream Overload Propagation

What to watch: Scaling out the frontend tier floods a downstream database or legacy service that cannot scale elastically. The bottleneck shifts downstream and the scaling policy masks the real failure. Guardrail: Model the downstream capacity limits and set the maximum instance count to stay within those bounds. Add a composite scaling metric that includes downstream error rate or queue depth, not just the local resource metric.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the quality of auto-scaling policy outputs before integrating them into infrastructure-as-code or deployment pipelines. Each criterion targets a known failure mode in scaling policy design.

CriterionPass StandardFailure SignalTest Method

Scale-Out Trigger Completeness

Policy specifies metric, threshold, evaluation period, and cooldown for each scale-out rule

Missing evaluation period or cooldown on any scale-out rule

Schema validation: check for required fields [METRIC], [THRESHOLD], [EVALUATION_PERIOD], [COOLDOWN] in each rule object

Scale-In Cooldown Adequacy

Scale-in cooldown is at least 2x the scale-out cooldown to prevent oscillation

Scale-in cooldown equals or is shorter than scale-out cooldown

Parse cooldown values and assert scale-in cooldown >= 2 * scale-out cooldown

Metric Selection Rationale

Each chosen metric includes a justification linking it to workload behavior and scaling intent

Metric listed without explanation or uses a proxy metric with no correlation argument

LLM-as-judge: check that [METRIC_JUSTIFICATION] field contains causal reasoning, not just metric name

Over-Provisioning Guardrail

Policy includes a maximum instance count and a budget-based cap with explicit rationale

No maximum instance count specified or cap exceeds stated budget constraint

Schema check: [MAX_INSTANCES] present and <= [BUDGET_CAP]; assert [CAP_RATIONALE] is non-empty

Cold-Start Latency Handling

Policy accounts for instance startup time with either pre-warming, step scaling, or buffer capacity

Scale-out rule assumes instantaneous capacity with no startup delay consideration

LLM-as-judge: verify [COLD_START_STRATEGY] field describes a concrete mitigation, not generic statement

Oscillation Risk Assessment

Policy identifies potential oscillation scenarios and specifies damping mechanisms

No mention of oscillation risk or damping strategy in output

Keyword check: output must contain damping mechanism reference and at least one oscillation scenario description

Multi-Metric Conflict Resolution

Policy defines precedence or combination logic when multiple scaling metrics conflict

Multiple metrics defined with no conflict resolution rule

Schema check: [CONFLICT_RESOLUTION] field present with valid enum value or explicit rule text

Failure Mode Coverage

Policy addresses metric unavailability, API throttling, and stale metric scenarios

Only normal-operation scaling described with no degradation behavior

LLM-as-judge: check for at least one failure mode per category (metric loss, API throttle, stale data) with defined fallback action

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single metric and a simple scale-out rule. Remove the oscillation risk and cold-start latency eval criteria. Replace the structured output schema with a free-text request for a policy summary.

Example snippet:

code
Design an auto-scaling policy for [SERVICE_NAME] based on [METRIC].
Describe when to scale out and when to scale in.

Watch for

  • Overly broad instructions producing vague thresholds like "scale when busy"
  • Missing cooldown periods leading to thrashing in simulation
  • No distinction between scale-out and scale-in logic
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.