Generated banner for AWS Compute
Generated logo for AWS Compute

AWS Compute

AWSOfficialPublished by AWS

  • Skill
  • Tool integration
  • Cloud and DevOps
  • Apache-2.0
  • No issues found

From the author

Provisions, scales, and operates Amazon EC2 virtual-machine workloads: instance-type selection (Graviton/Arm64, burstable T credits, GPU, instance store vs EBS), launch templates, Auto Scaling groups (scaling policies, instance refresh, mixed instances, Spot, warm pools, lifecycle hooks), IMDSv2, placement groups, Elastic IPs, AMI lifecycle, and Systems Manager fleet operations (Session Manager, Run Command, Patch Manager). Applies to EC2 instance and fleet questions, InsufficientInstanceCapacity, CPU-credit/surplus charges, IMDSv2 401s, instances stuck in Pending:Wait, ASG not replacing unhealthy instances, status-check failures, SSH refused/timed out, or instances missing as SSM managed nodes. For a single secure instance launch, the launching-ec2-instance-with-best-practices skill is more appropriate; for instance profiles, see setting-up-ec2-instance-profiles; for Image Builder, see amazon-ec2-image-builder. Does NOT cover Lambda, ECS/Fargate, EKS, VPC/ALB/NLB design, or IAM policy authoring.
— the description by AWS

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides operational guidance for Amazon EC2, covering the full lifecycle of virtual machine workloads. It addresses instance-type selection, launch template configuration, Auto Scaling group (ASG) management, and fleet operations via AWS Systems Manager. It is designed to help users navigate common pitfalls like IMDSv2 configuration, health check settings, and cost-optimization strategies for burstable instances, while providing clear troubleshooting paths for connectivity, capacity, and status-check failures.

What it does

  • Guides instance-type selection including Graviton, GPU, and burstable T-series options.
  • Configures Auto Scaling groups with scaling policies, instance refresh, and lifecycle hooks.
  • Manages AMI lifecycles including deprecation, disabling, and cross-account sharing.
  • Facilitates fleet operations like patching and SSH-less access via Systems Manager.
  • Provides troubleshooting steps for common EC2 errors like InsufficientInstanceCapacity and status-check failures.
  • Enforces security best practices such as IMDSv2 and instance profile usage.

When to use it

  • When designing or scaling an EC2-based compute fleet.
  • When troubleshooting connectivity, capacity, or health check issues in an ASG.
  • When optimizing EC2 costs through instance-type selection or Spot instance usage.
  • When performing rolling updates or AMI migrations across a fleet.
  • When configuring secure, SSH-less management for private instances.

Advantages

  • Centralizes complex EC2 operational knowledge and common configuration pitfalls.
  • Provides actionable troubleshooting tables for rapid incident resolution.
  • Promotes security-first configurations like IMDSv2 and Session Manager.
  • Clarifies the distinction between deprecated and modern provisioning methods.
  • Offers clear guidance on cost-saving strategies like Graviton and Spot instances.

Usage examples

“How do I ensure my Auto Scaling group replaces instances that fail my load balancer health checks?”
The agent explains that ASGs ignore ELB health checks by default and provides the command to set --health-check-type ELB.
“My instances are stuck in Pending:Wait state, what is happening?”
The agent identifies that a lifecycle hook is likely waiting for a heartbeat and provides the command to complete the action.
“How can I safely roll out a new AMI to my existing fleet?”
The agent details the process of updating the launch template to a specific version and initiating an instance refresh.
“Why am I getting an InsufficientInstanceCapacity error?”
The agent clarifies that this is an AWS capacity issue in a specific AZ, not a user quota, and suggests trying a different AZ or instance type.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/aws/aws-compute/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip aws-compute.zip -d .agents/skills

Documentation by AWS

Amazon EC2 Compute

Best experience with the AWS MCP server; also works with the AWS CLI alone — no hard dependency on either.

Critical Warnings

Launch configurations are deprecated and do not support current EC2 instance types; new accounts cannot create them. Use launch templates for every new Auto Scaling group. See auto-scaling.md.

ASGs ignore ELB health checks by default: An Auto Scaling group only uses EC2 status checks unless you set --health-check-type ELB. Without it, instances failing the load balancer's health check stay in service forever. See auto-scaling.md.

IMDSv2 hop limit breaks containers: the default HttpPutResponseHopLimit of 1 makes the IMDSv2 token PUT response fail to reach a containerized process (the extra hop exceeds the response TTL), so the token request times out. Set HttpPutResponseHopLimit=2 for bridge/awsvpc container workloads. (If IMDSv2 is required, a subsequent tokenless GET returns 401; if optional, it silently falls back to IMDSv1.) See provisioning.md.

T3/T3a/T4g default to unlimited mode: Unlike T2 (standard), these burst without throttling but bill surplus CPU credits when 24h-average CPU exceeds baseline — a silent cost leak. See instance-selection.md.

Instance store is ephemeral: Data on instance store volumes is lost on stop, hibernate, terminate, instance-type change, and host failure — it survives only a reboot. Put anything durable on EBS/EFS/S3. See instance-selection.md.

Which do you need?

If you're deciding...Guidance
Instance family / size / Graviton / GPU / burstableinstance-selection.md — start with the workload→family table
How to define instances once and reuse (launch template)provisioning.md
How to run many instances that scale automaticallyauto-scaling.md
How to access/patch/manage instances without SSH keyssystems-manager.md

Quick Navigation

You want to...Go to
Pick an instance type, Graviton vs x86, burstable credits, GPU, instance store vs EBSinstance-selection.md
Create a launch template, user data, key pairs, IMDSv2, placement groups, Elastic IPsprovisioning.md
Set up or fix an Auto Scaling group, scaling policies, instance refresh, Spot, lifecycle hooksauto-scaling.md
Get SSH-less access, patch a fleet, or fix an instance not showing as a managed nodesystems-manager.md
Create, share, or retire (deprecate/disable/deregister) an AMIami-management.md
Fix something broken (can't connect, status-check fail, capacity error, stuck instances)troubleshooting.md

Common Workflows

"Stand up an autoscaling web fleet" → Create a launch template (AMI, type, IMDSv2), then an ASG referencing it with --health-check-type ELB and a target-tracking policy, see auto-scaling.md. For the public entry point, secure the load balancer (TLS/ACM, WAF, security response headers) per the Security Considerations below and the load-balancer notes in auto-scaling.md — the load-balancer build itself belongs to aws-networking.

"Roll out a new AMI to my fleet" → New launch template version → instance refresh; pin a numeric launch-template version so rollback works, see auto-scaling.md.

"Connect to a private instance without a bastion" → Give the instance SSM permissions (an instance profile with AmazonSSMManagedInstanceCore, or account-level DHMC) plus a network path, then use Session Manager, see systems-manager.md.

"Cut EC2 cost" → Right-size (burstable vs fixed-performance), Graviton where the app supports Arm64, Spot with price-capacity-optimized for fault-tolerant fleets, release idle Elastic IPs, see instance-selection.md.

Troubleshooting

SymptomLikely causeQuick fix
SSH "Connection timed out"Network path (SG/NACL/route/no public IP)Open TCP 22 from your IP; check route to IGW; verify public IP — see troubleshooting.md
SSH "Connection refused"Host: sshd down or still bootingWait for boot; check sshd/port via Session Manager or serial console
InsufficientInstanceCapacityAWS lacks capacity of that type in the AZ (NOT a quota)Try another AZ / instance type / retry; don't request a quota increase
InstanceLimitExceededvCPU quota reached (this IS a quota)Request a Service Quotas increase for the instance family
ASG never replaces LB-unhealthy instancesHealth check type still EC2Set --health-check-type ELB
Instances stuck in Pending:Wait, terminated after ~1hLifecycle hook never completed (heartbeat 3600s, default ABANDON)Call complete-lifecycle-action CONTINUE, or set DefaultResult CONTINUE
System status check failedAWS host/hardwareStop/start to migrate to new hardware (reboot won't)
Instance status check failedInstance OS/network configReboot or fix the OS/network config

Full tables and more errors in troubleshooting.md.

Security Considerations

  • Enforce IMDSv2 (HttpTokens=required) on launch templates to block SSRF-based credential theft; set the account-level default per Region (applies to new launches only).

  • Prefer Session Manager over inbound SSH — no open port 22, no key management, and a CloudTrail record of session API calls; enable Session Manager session logging to CloudWatch Logs/S3 (off by default) to capture the in-session commands themselves — see systems-manager.md.

  • Use instance profiles, never embedded credentials; scope the role to least privilege.

  • Encrypt EBS/AMIs; to share an encrypted AMI cross-account, re-encrypt under a customer-managed KMS key (the default aws/ebs key can't be shared).

  • Enable CloudTrail in all Regions to audit EC2/ASG/SSM API activity, and alarm on sensitive actions (security-group changes, RunInstances/TerminateInstances from unexpected principals) so unauthorized changes surface.

  • For public-facing web fleets, encrypt traffic in transit with an ACM certificate on the load balancer's HTTPS listener and add AWS WAF for defense in depth against common web exploits — the load-balancer/WAF setup itself lives in aws-networking.

  • For hardening beyond this guidance, see AWS EC2 security best practices and CIS Benchmarks for the guest OS.

Not Covered By This Skill

  • Launching a single hardened instance with best-practice defaults → use the launching-ec2-instance-with-best-practices skill

  • Creating IAM roles / instance profiles for EC2 → use the setting-up-ec2-instance-profiles skill

  • Building AMIs with an Image Builder pipeline → use the amazon-ec2-image-builder skill

  • Lambda / serverless → aws-serverless; ECS/Fargate → aws-containers; EKS/Kubernetes → kubernetes

  • VPC, subnets, ALB/NLB, endpoints → aws-networking or built-in knowledge

  • IAM policy logic and CloudWatch dashboards/agent setup → aws-iam, aws-observability

Files

references/auto-scaling.md

EC2 Auto Scaling

Overview

Running a self-healing, elastic fleet with Auto Scaling groups (ASGs): health checks, scaling policies, rolling updates via instance refresh, mixed instances/Spot, warm pools, lifecycle hooks, and load-balancer attachment.

Create an ASG

Creating an ASG requires only a name, MinSize, and MaxSize, plus a launch source (a launch template — recommended, see provisioning.md — or a MixedInstancesPolicy). DesiredCapacity is optional (defaults to MinSize). Specifying subnets (VPCZoneIdentifier) across multiple AZs is optional at the API level but a strongly recommended resilience practice.

aws autoscaling create-auto-scaling-group \
  --auto-scaling-group-name my-asg \
  --launch-template LaunchTemplateName=my-app,Version='3' \
  --min-size 2 --max-size 6 --desired-capacity 2 \
  --vpc-zone-identifier "subnet-aaa,subnet-bbb" \
  --health-check-type ELB --health-check-grace-period 300

Health checks (the #1 gotcha)

EC2 status checks are always on. ELB health checks are ignored unless you set --health-check-type ELB — otherwise an instance that fails the target group's health check but passes EC2 checks stays in service and is never replaced. Fix an existing group:

aws autoscaling update-auto-scaling-group --auto-scaling-group-name my-asg \
  --health-check-type ELB --health-check-grace-period 300

Grace period: console default 300s, CLI/SDK default 0 (off). Too short → new instances are killed before they finish booting (symptom: ASG "keeps replacing instances"). If an instance leaves the running state, it's replaced immediately regardless of grace period.

Scaling policies

PolicyWhen
Target tracking (recommended default)Keep a metric at a target (e.g., ASGAverageCPUUtilization 50%, or ALBRequestCountPerTarget)
Step scalingDifferent-sized responses based on alarm breach magnitude
Simple scaling (legacy)Avoid for new work
Predictive scalingML forecast that provisions ahead of predictable cycles — complements, not replaces, dynamic scaling

Target tracking uses instance warmup (DefaultInstanceWarmup), not the ASG cooldown (cooldown applies to simple scaling). Set warmup so not-yet-ready instances don't skew metrics.

aws autoscaling put-scaling-policy --auto-scaling-group-name my-asg \
  --policy-name cpu50 --policy-type TargetTrackingScaling \
  --target-tracking-configuration '{"PredefinedMetricSpecification":{"PredefinedMetricType":"ASGAverageCPUUtilization"},"TargetValue":50.0}'

Instance refresh (rolling updates)

Roll out a launch-template change (new AMI, user data) by replacing instances in batches:

aws autoscaling start-instance-refresh --auto-scaling-group-name my-asg \
  --preferences '{"MinHealthyPercentage":90,"InstanceWarmup":300}'
  • Skip matching is enabled by default in the console — the refresh skips instances already matching the target config. If nothing gets replaced, the ASG probably isn't pointing at a new, specific launch-template version (e.g., it uses $Latest/$Default or an SSM-parameter AMI that resolved unchanged). Point the ASG at the new numeric version or disable skip matching.

  • MinHealthyPercentage default 90; MaxHealthyPercentage 100–200 (requires Min set, spread ≤100). Setting MinHealthyPercentage=100 (with MaxHealthyPercentage>100) launches replacements before terminating old ones (faster, extra cost).

  • Checkpoints replace in stages (ascending %, last = 100). Monitor with describe-instance-refreshes; cancel with cancel-instance-refresh; mid-flight rollback-instance-refresh.

  • Auto-rollback is unsupported when the launch template version is $Latest/$Default or the AMI is an SSM parameter — pin a numeric version to enable it.

Mixed instances and Spot

A mixed instances policy combines a launch template with instance-type overrides and an on-demand/Spot distribution for cost and resilience.

  • Spot allocation strategy: use price-capacity-optimized (low price + available capacity → fewer interruptions). capacity-optimized is a fine alternative; lowest-price is legacy and interrupts more.

  • Enable Capacity Rebalancing (--capacity-rebalance) so the ASG proactively replaces at-risk Spot instances on the rebalance recommendation, before the 2-minute interruption notice.

  • Diversify across many instance types and AZs. OnDemandBaseCapacity guarantees a floor of On-Demand; OnDemandPercentageAboveBaseCapacity splits the rest.

Warm pools

A warm pool keeps pre-initialized (Stopped by default, or Running/Hibernated) instances ready, cutting scale-out latency for long-booting apps (e.g., 30s vs 4min). Default size = max − desired; cap with MaxGroupPreparedCapacity. Warm-pool instances don't contribute to scaling metrics until they enter service.

Lifecycle hooks

Hooks pause instances at Pending:Wait (launch) or Terminating:Wait (terminate) so you can run setup/teardown.

  • Heartbeat timeout defaults to 3600s (1h); DefaultResult defaults to ABANDON — a launch hook that times out terminates the instance. This is the classic "stuck in Pending:Wait for an hour then killed."

  • Signal completion: aws autoscaling complete-lifecycle-action --lifecycle-action-result CONTINUE …, or extend with record-lifecycle-action-heartbeat. If the hook doesn't need to block, set DefaultResult=CONTINUE. Verify the notification target (SNS/SQS/EventBridge) and its IAM permissions. Since payloads carry instance metadata, enable SSE-KMS on the SNS topic/SQS queue and restrict its access policy so only authorized AWS accounts and principals can subscribe or poll — verify each SNS subscriber and SQS consumer is expected, and rely on SNS subscription confirmation to keep unauthorized endpoints from receiving instance metadata.

Attaching a load balancer target group

Attach the target group to the ASG (not the instances) — the ASG auto-registers/deregisters:

aws autoscaling attach-traffic-sources --auto-scaling-group-name my-asg \
  --traffic-sources Identifier=<target-group-arn>
  • Target group target type must be instance (not ip) for an ASG. LB, target group, and ASG must share account/VPC/Region.

  • Don't manually register instances — the ASG owns registration.

  • Deregistration delay (connection draining) defaults to 300s; premature termination during draining causes client 5xx.

  • The launch template's security group must allow inbound from the load balancer; apply launch-template changes to existing instances via instance refresh.

  • For a public web fleet, terminate TLS on the load balancer with an ACM certificate (HTTPS listener, redirect HTTP→HTTPS) so client traffic is encrypted in transit; the listener/ALB configuration itself belongs to aws-networking.

  • For a public web fleet, also set security response headers (HSTS, CSP, X-Frame-Options, X-Content-Type-Options) via an ALB response header policy or application middleware; the detailed ALB setup belongs to aws-networking.

  • For a public web fleet, front the ALB with AWS WAF for defense in depth against common web exploits (SQL injection, XSS, bot traffic); the detailed WAF rule configuration belongs to aws-networking.

Monitoring

Enable ASG group metrics (enable-metrics-collection) plus detailed instance monitoring in the launch template, and alarm on key metrics (GroupInServiceInstances, unhealthy host count) and ASG activity notifications (to a KMS-encrypted SNS topic) so scaling failures surface early.

For a security audit trail (not just operational metrics), ensure CloudTrail is enabled in all Regions and alarm on sensitive Auto Scaling / EC2 API actions — e.g. UpdateAutoScalingGroup, DeleteAutoScalingGroup, and unexpected scaling activity — so unauthorized configuration changes are detected.

Common Errors

Error/SymptomCauseFix
ASG never replaces LB-unhealthy instancesHealth check type still EC2--health-check-type ELB
ASG keeps replacing booting instancesGrace period too shortRaise grace period or use a launch lifecycle hook
Instances stuck in Pending:Wait, killed after ~1hHook not completed (3600s, ABANDON)complete-lifecycle-action CONTINUE, or DefaultResult=CONTINUE
Instance refresh replaced nothingSkip matching + config unchangedPoint ASG at new numeric launch-template version, or disable skip matching
Instance refresh won't roll backLaunch template uses $Latest/$Default/SSM AMIPin a numeric version + specify desired config
Frequent Spot interruptionslowest-price strategy, few typesprice-capacity-optimized + Capacity Rebalancing + diversify
Can't attach target groupTarget type is ipRecreate target group with target type instance
MaxHealthyPercentage rejectedOut of 100–200 or Min unset or spread >100Set both, keep spread ≤100

Security Considerations

  • Lifecycle-hook notifications carry instance metadata — prevent confused-deputy on the notification role by adding aws:SourceArn (the ASG ARN) / aws:SourceAccount condition keys to the IAM service role's trust policy (the statement trusting autoscaling.amazonaws.com), not to the SNS/SQS policy. Separately harden the topic/queue: enable SSE-KMS, restrict the access policy to authorized accounts/principals and restrict publish to that role, verify each subscriber/consumer is expected, and require SNS subscription confirmation so unauthorized endpoints can't receive it.

  • Audit ASG configuration changes — ensure CloudTrail is on and alarm on sensitive actions (UpdateAutoScalingGroup, DeleteAutoScalingGroup, unexpected scaling activity) to catch unauthorized changes.

  • Inherit least-privilege from the launch template — the template's IMDSv2/security-group/instance-profile settings propagate to every launched instance, so harden it (see provisioning.md).

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs an MCP server, Needs Node.js

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
AWS
Publisher
AWS (Official)
Source
aws/agent-toolkit-for-aws · skills/core-skills/aws-compute · commit 0a218f8
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • NOTICE (added by AutoGineer from NOTICE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Also distributed in
aws/agent-toolkit-for-aws

AutoGineer is not affiliated with or endorsed by AWS or AWS.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download aws-compute.zip