AWS field guide
Scale services around measurable demand
Scale long-lived services from demand and saturation signals, with deployment health treated as part of the architecture.
Use this pattern when
The workload needs a persistent runtime, custom networking, or more control than function execution provides.
Reference architecture
Responsibilities and controls, not a deployment template.
Client
Service request
Elastic Load Balancing
Health-aware routing
Amazon ECS
Desired service state
AWS Fargate
Isolated running tasks
Amazon CloudWatch
Scaling and rollback signal
Decisions that shape the pattern
- Set CPU and memory from measured profiles.
- Scale on a workload signal, not CPU alone.
- Keep tasks disposable and state external.
Security boundaries
- Use one task role per service.
- Keep tasks in private subnets where practical.
- Pull secrets at runtime without baking them into images.
Reliability posture
- Use meaningful health checks.
- Keep capacity across multiple Availability Zones.
- Roll back deployments from service-level signals.
Starter implementation
Start from deployable infrastructure
Review every permission, limit, Region, and cost assumption before production.
import { Duration, Stack, StackProps } from 'aws-cdk-lib';
import * as apigateway from 'aws-cdk-lib/aws-apigateway';
import * as athena from 'aws-cdk-lib/aws-athena';
import * as bedrock from 'aws-cdk-lib/aws-bedrock';
import * as budgets from 'aws-cdk-lib/aws-budgets';
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
import * as origins from 'aws-cdk-lib/aws-cloudfront-origins';
import * as cloudtrail from 'aws-cdk-lib/aws-cloudtrail';
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as ecs from 'aws-cdk-lib/aws-ecs';
import * as patterns from 'aws-cdk-lib/aws-ecs-patterns';
import * as events from 'aws-cdk-lib/aws-events';
import * as targets from 'aws-cdk-lib/aws-events-targets';
import * as glue from 'aws-cdk-lib/aws-glue';
import * as iam from 'aws-cdk-lib/aws-iam';
import * as kms from 'aws-cdk-lib/aws-kms';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as sources from 'aws-cdk-lib/aws-lambda-event-sources';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
import * as sqs from 'aws-cdk-lib/aws-sqs';
import { Construct } from 'constructs';
export class PatternStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const cluster = new ecs.Cluster(this, 'Cluster');
const service = new patterns.ApplicationLoadBalancedFargateService(this, 'Service', {
cluster,
cpu: 512,
memoryLimitMiB: 1024,
desiredCount: 2,
taskImageOptions: { image: ecs.ContainerImage.fromRegistry('public.ecr.aws/nginx/nginx:stable') },
});
service.targetGroup.configureHealthCheck({ path: '/health' });
service.service.enableDeploymentAlarms(['HighErrorRate'], { behavior: ecs.AlarmBehavior.ROLLBACK_ON_ALARM });
}
}
Before production
Adoption checklist
- 01Measure steady and peak demand.
- 02Set deployment circuit breakers.
- 03Test task termination.
- 04Add autoscaling cooldowns.
- 05Track cost per request or job.
From the journal
Related field notes
Selected from service names and architecture signals used by this pattern.
Elastic Beanstalk Cluster Mode: Managed Compute Arrives
Elastic Beanstalk now offers a service-operated compute layer, abstracting EC2 instances for containerized applications.
EKS 1.37: Metrics API GA, DRA Taints, Scale-to-Zero Beta
Kubernetes 1.37 lands on EKS, bringing GA Metrics API, DRA taints, and beta scale-to-zero. Does it matter?
ECS adds VPC Lattice for controlled deployments
ECS now integrates with VPC Lattice to manage traffic shifting for blue/green, linear, and canary deployments. This moves traffic management closer to the application layer.
Was this playbook useful?
One click helps prioritize deeper examples and updates.