Amazon SOA-C02: Compute and Auto Scaling — Study Guide

Part of the AWS SysOps Administrator Associate SOA-C02 — Study Guide. Practice with verified answers in the Amazon exam hub, or take timed practice tests on ExamRoll.io.

This domain covers managing EC2 instances and Auto Scaling to deliver reliable, cost-effective compute capacity. It focuses on instance lifecycle operations, scaling strategies, load-balancer integration, placement for performance and resilience, and maintenance/termination behaviors that affect availability and state. Operational mastery means choosing the right instance types, launch configuration patterns, scaling policies, and health-check integration to meet SLAs while controlling cost.

EC2 instance lifecycle and management

EC2 lifecycle management starts at the point of launch configuration: use Launch Templates (aws ec2 create-launch-template / console) to capture AMI, instance type, IAM instance profile, user-data, network interfaces, EBS mapping, and metadata options; templates support versioning which makes immutable deploys straightforward. Immutable deploys use a new launch-template version (or new launch template) and either create a new Auto Scaling group or use ASG instance refresh to replace instances; avoid in-place upgrades of running instances when changes affect boot-time behavior or AMI-level patches.

Operational CLI/console patterns include aws ec2 run-instances –launch-template LaunchTemplateId=lt-xxx,Version=2 for one-off launches and aws autoscaling create-auto-scaling-group –launch-template LaunchTemplateId=lt-xxx,Version=’$Latest’ for ASG-driven launches. Decide between AMI baking (Packer/CodeBuild) and user-data startup scripts based on boot time: bake heavy dependencies into AMIs to reduce boot duration; use user-data for environment-specific wiring. For ephemeral storage, remember instance-store volumes are lost at termination; configure root and data volumes with DeleteOnTermination=false if you require persistence of EBS after instance termination.

Auto Scaling groups, policies, and lifecycle hooks

Auto Scaling Groups (ASGs) are configured with a launch template or launch configuration and control desired/min/max capacity across Availability Zones. Choose launch template + MixedInstancesPolicy for cost-optimized fleets that blend On-Demand and Spot with an instance type list; use instance weighting and capacity-optimized allocation strategies for predictable capacity. For deploys, prefer immutable patterns: create a new launch-template version and perform an ASG instance refresh or blue/green swap rather than reconfiguring existing instances.

Scaling policies are expressed as:

Use lifecycle hooks (aws autoscaling put-lifecycle-hook –lifecycle-hook-name name –auto-scaling-group-name my-asg –lifecycle-transition autoscaling:EC2_INSTANCE_TERMINATING –heartbeat-timeout 300 –default-result ABANDON) to pause instance termination/launch. Lifecycle hooks allow you to drain connections, replicate state (to S3/RDS), or notify orchestration systems via SNS/SQS/Lambda before completion; always set HeartbeatTimeout and a default action to avoid stuck states.

Elastic Load Balancing types and health checks

Choose load balancer type by traffic pattern: Application Load Balancer (ALB) for HTTP/HTTPS with content-based routing and host/path rules; Network Load Balancer (NLB) for extreme performance and static IPs for TCP/UDP; Classic Load Balancer (CLB) only for legacy stacks. Create ALBs and target groups with aws elbv2 create-load-balancer and aws elbv2 create-target-group; register ASG targets by using the ASG’s target group association for automatic lifecycle health integration.

Health-check integration requires aligning ASG and ELB health checks: set ASG HealthCheckType to ELB (aws autoscaling update-auto-scaling-group –auto-scaling-group-name my-asg –health-check-type ELB –health-check-grace-period 300) so an instance is considered healthy only after the load balancer marks its target healthy. Health check types and implications:

Stickiness implications: ALB target group stickiness uses application cookie-based affinity (duration-based) which can improve session affinity but reduces even distribution and complicates rolling updates. NLB supports client IP affinity; use stickiness only when session state cannot be externalized.

Instance placement, capacity planning, and scaling metrics

Placement decisions affect latency and failure domains: placement groups offer cluster (low-latency network), spread (one instance per rack for critical instances), and partition (fault-isolated partitions) strategies. ASGs balance instances across AZs by default; prefer AZ-aware capacity planning to avoid single-AZ hotspots. For CLI: aws ec2 create-placement-group –strategy cluster|spread|partition.

Capacity planning considers instance types, purchasing options, and metrics:

Instance recovery, termination behavior, and maintenance

Plan for instance failures and maintenance by enabling automatic recovery for hardware issues (CloudWatch alarm with EC2 Recover action) and handling scheduled events (describe-instance-status). Configure instance-initiated-shutdown-behavior and EBS DeleteOnTermination flags to control volume lifecycle; use aws ec2 modify-instance-attribute –instance-id i-xxx –block-device-mappings to adjust.

Termination behavior in ASGs: ASG termination policies decide which instance to terminate first (Default: oldest launch configuration or instance health and AZ balancing heuristics). Important operational details:

Common Pitfalls and Decision Criteria

Practical Problem: Use-Case Scenario

StreamingCo operates a video thumbnail API experiencing daily traffic spikes and uses local disk caches on EC2 instances; recently, scale-up has been slow and terminated instances lose cache leading to poor response times.

  1. Migrate launch configuration into a Launch Template and bake a lightweight AMI with runtime dependencies; use aws ec2 create-launch-template and versioning for immutable deploys.
  2. Configure an ASG with a MixedInstancesPolicy that lists several instance types and Spot + On-Demand allocation to balance cost and capacity.
  3. Attach an ALB and use TargetTrackingScaling on the ALB RequestCountPerTarget metric with a HealthCheckGracePeriod set to the application’s bootstrap time.
  4. Implement lifecycle hooks on ASG terminations to drain connections and run a Lambda/SNS flow to persist necessary cache keys to ElastiCache or S3 before termination.
  5. Externalize session and cache state to ElastiCache or S3 and use placement groups/az-distribution to meet latency and fault-domain requirements.

Rationale: Using launch templates and immutable deploys reduces boot variability; ALB-targeted target tracking ties scaling to request load rather than CPU; lifecycle hooks prevent data loss on termination; externalizing cache removes dependence on ephemeral local state, enabling fast, safe scaling and lower cost through mixed instance/purchase strategies.


Storage and Data Management · All domains · Databases and Caching

Practice these questions → · Timed practice on ExamRoll.io →

Pass the whole exam — not just this question

You found this answer. Get every verified question and explanation in one place, and save hours of prep. Free to start.

Pass your exam →

Browse Amazon →

Related guides

All-in-one access

One subscription. Every exam.

Every plan unlocks unlimited answer search, practice tests, AI explanations, and the full resource library — in 20+ languages.

Monthly
24.87
Just €0.83/day
Everything included:
  • Unlimited answer search
  • Unlimited practice tests
  • AI-powered explanations
  • Full resource library
  • 20+ languages
  • Weekly content updates
  • Rewards & referrals
  • Priority support
Start free trial

No credit card required*

Best value
12 months
179.87
Just €0.49/daySave 40%
Everything included:
  • Unlimited answer search
  • Unlimited practice tests
  • AI-powered explanations
  • Full resource library
  • 20+ languages
  • Weekly content updates
  • Rewards & referrals
  • Priority support
Start free trial

No credit card required*

✓ Free plan included · ✓ Cancel anytime · ✓ All plans unlock the full product