AWS Compute
AWSOfficialPublished by AWS
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- No issues found
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
Download the skill as a ZIP:
https://autogineer.com/agent-skills/aws/aws-compute/downloadUnzip 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 / burstable | instance-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 automatically | auto-scaling.md |
| How to access/patch/manage instances without SSH keys | systems-manager.md |
Quick Navigation
| You want to... | Go to |
|---|---|
| Pick an instance type, Graviton vs x86, burstable credits, GPU, instance store vs EBS | instance-selection.md |
| Create a launch template, user data, key pairs, IMDSv2, placement groups, Elastic IPs | provisioning.md |
| Set up or fix an Auto Scaling group, scaling policies, instance refresh, Spot, lifecycle hooks | auto-scaling.md |
| Get SSH-less access, patch a fleet, or fix an instance not showing as a managed node | systems-manager.md |
| Create, share, or retire (deprecate/disable/deregister) an AMI | ami-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
| Symptom | Likely cause | Quick 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 booting | Wait for boot; check sshd/port via Session Manager or serial console |
InsufficientInstanceCapacity | AWS lacks capacity of that type in the AZ (NOT a quota) | Try another AZ / instance type / retry; don't request a quota increase |
InstanceLimitExceeded | vCPU quota reached (this IS a quota) | Request a Service Quotas increase for the instance family |
| ASG never replaces LB-unhealthy instances | Health check type still EC2 | Set --health-check-type ELB |
Instances stuck in Pending:Wait, terminated after ~1h | Lifecycle hook never completed (heartbeat 3600s, default ABANDON) | Call complete-lifecycle-action CONTINUE, or set DefaultResult CONTINUE |
| System status check failed | AWS host/hardware | Stop/start to migrate to new hardware (reboot won't) |
| Instance status check failed | Instance OS/network config | Reboot 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/ebskey 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/TerminateInstancesfrom 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-practicesskillCreating IAM roles / instance profiles for EC2 → use the
setting-up-ec2-instance-profilesskillBuilding AMIs with an Image Builder pipeline → use the
amazon-ec2-image-builderskillLambda / serverless →
aws-serverless; ECS/Fargate →aws-containers; EKS/Kubernetes →kubernetesVPC, subnets, ALB/NLB, endpoints →
aws-networkingor built-in knowledgeIAM policy logic and CloudWatch dashboards/agent setup →
aws-iam,aws-observability
Files
- ATTRIBUTION.mdAdded by AutoGineer887 B
- LICENSELicence file added by AutoGineer9.9 KiB
- NOTICELicence file added by AutoGineer67 B
- SKILL.md8.7 KiB
- references/ami-management.md5.9 KiB
- references/auto-scaling.md10.1 KiB
- references/instance-selection.md5.7 KiB
- references/provisioning.md9.2 KiB
- references/systems-manager.md7.4 KiB
- references/troubleshooting.md5.7 KiB
references/provisioning.md
EC2 Provisioning
Overview
Defining reusable instance configuration with launch templates, plus user data, key pairs/SSH access, IMDSv2, placement groups, and Elastic IPs.
Launch templates (use these, not launch configurations)
A launch template captures AMI, instance type, network interfaces, user data, security groups, instance profile, block device mappings, metadata options, and tags — versioned and reusable by Auto Scaling groups, Spot fleets, and one-off launches.
Launch configurations are deprecated: they do not support current EC2 instance types, and new accounts cannot create them — see the AWS launch-configurations docs. Always use launch templates.
aws ec2 create-launch-template \
--launch-template-name my-app \
--version-description v1 \
--launch-template-data '{
"ImageId": "ami-xxxxxxxx",
"InstanceType": "m7g.large",
"IamInstanceProfile": {"Name": "my-app-instance-profile"},
"MetadataOptions": {"HttpTokens": "required", "HttpPutResponseHopLimit": 2},
"BlockDeviceMappings": [{"DeviceName": "/dev/xvda", "Ebs": {"Encrypted": true}}],
"Monitoring": {"Enabled": true},
"TagSpecifications": [{"ResourceType":"instance","Tags":[{"Key":"managed_by","Value":"aws-skills"},{"Key":"skill","Value":"aws-compute"}]}]
}'Before hardcoding an instance type like m7g.large in production, verify it is current-generation for the target Region: aws ec2 describe-instance-types --filters Name=current-generation,Values=true --query 'InstanceTypes[].InstanceType'. The current-generation filter (values true|false) returns whether a type is the latest generation of its instance family, and filter names/values are case-sensitive. Note the command is Region-scoped, so a type may be current-generation but not offered in every Region — cross-check availability with aws ec2 describe-instance-type-offerings --location-type region --filters Name=instance-type,Values=m7g.large.
"Monitoring": {"Enabled": true} turns on detailed (1-minute) CloudWatch metrics — a production-ready default that also improves ASG scaling responsiveness (omit it only to save cost on non-critical fleets, which falls back to 5-minute metrics).
When the template sets SecurityGroupIds, scope those rules to least privilege — reference another security group for internal/tier-to-tier access, or a specific CIDR for known callers, rather than 0.0.0.0/0 (justify any open ingress). Instances inherit these rules at launch, so an over-permissive template propagates to the whole fleet.
Versioning: reference a version by number, $Latest, or $Default (the unspecified default is $Default). For instance refresh and rollback, pin a numeric version — rollback is unsupported when the ASG uses $Latest/$Default or an SSM-parameter AMI. Create a new version with create-launch-template-version; changing a template does not touch running instances (do an instance refresh — see auto-scaling.md).
IMDSv2
IMDSv2 requires a session token (PUT to /latest/api/token, then the token in each metadata GET), defeating SSRF credential theft. Enforce it:
HttpTokens=requiredis what enforces IMDSv2 — it blocks IMDSv1 (a tokenless/invalid-token GET then returns401 Unauthorized); also setHttpEndpoint=enabled.HttpPutResponseHopLimitdefaults to 1 (range 1–64) and does NOT enforce IMDSv2. Set it to 2 for containers on EC2 — the default hop limit 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; the extra hop covers container → bridge → IMDS. (If IMDSv2 is required, a subsequent tokenless GET returns 401; if optional, it silently falls back to IMDSv1. Host-networked containers are unaffected.)Account-level (per Region) default:
aws ec2 modify-instance-metadata-defaults --http-tokens required --http-put-response-hop-limit 2(org-wide enforcement is a separate Organizations declarative policy). Applies only to new launches — existing instances are unchanged; fix each withmodify-instance-metadata-options. Launch-time settings override the account default.
User data
Bootstrap scripts run by cloud-init (Linux) / EC2Launch (Windows). Runs once at first boot by default. On Linux, cloud-init runs user data as root; for every-boot, use a cloud-init #cloud-config with [scripts-user, always] (these are Linux-specific — Windows uses EC2Launch v2, which runs as Local System and re-runs with frequency: always). Shell scripts start with #!; 16 KB limit before base64 (gzip to fit). Output goes to /var/log/cloud-init-output.log — check it when bootstrap "didn't run."
Never put secrets in user data. It is stored unencrypted, is readable via IMDS by any process on the instance (http://169.254.169.254/latest/user-data), is echoed to /var/log/cloud-init-output.log, and appears in the requestParameters of the RunInstances CloudTrail event. Fetch secrets at boot from AWS Secrets Manager or SSM Parameter Store (SecureString) using the instance-profile role.
Key pairs and SSH access
Types: RSA (Linux + Windows) or ED25519 (Linux only).
chmod 400 key.pem.Default users by AMI:
ec2-user(Amazon Linux/RHEL/SUSE),ubuntu(Ubuntu),admin(Debian),centos(CentOS),bitnami(Bitnami); RHEL/SUSE also acceptroot. For other AMIs the default is typicallyec2-user— confirm with the AMI provider rather than assumingroot.EC2 Instance Connect pushes a temporary key valid 60 seconds (
aws ec2-instance-connect send-ssh-public-key …) — connect immediately or you getPermission denied (publickey).Prefer Session Manager (no keys, no open port 22) — see systems-manager.md.
Lost key: create a new key pair and reattach the public key via Instance Connect, Session Manager, or by editing
authorized_keyson the detached root volume.
Placement groups
| Strategy | Placement | Limit | Use for |
|---|---|---|---|
| Cluster | Packed in one AZ, high bandwidth | Capacity risk if grown incrementally | Tightly coupled HPC/low-latency |
| Spread | Distinct hardware (one instance per rack) | Max 7 running instances per AZ per group | Small set of critical instances |
| Partition | Isolated racks per partition | Max 7 partitions per AZ (instances per partition limited only by account limits) | HDFS/HBase/Cassandra/Kafka |
Cluster: launch all instances of the same type in one request; on InsufficientInstanceCapacity, stop/start all group members to re-place them. Reference a shared placement group by ID (not name) in the CLI. The spread and partition per-AZ maximums above are firm documented hard limits (not raisable Service Quota defaults) and apply even for shared placement groups.
Elastic IPs
All public IPv4 is billed per hour — including idle Elastic IPs and EIPs on stopped instances (check current rates on the EC2 pricing page or via
aws pricing get-products). Release unused ones:aws ec2 release-address --allocation-id <id>(EIPs keep billing after the instance is terminated until released). The per-Region EIP quota is low by default (check the current value withaws service-quotas get-service-quota --service-code ec2 --quota-code L-0263D0A3).An auto-assigned public IP changes on stop/start; attach an Elastic IP for a stable address (common cause of "SSH broke after restart").
Remap on failover by disassociating/reassociating the EIP (no release needed).
Common Errors
| Error | Cause | Fix |
|---|---|---|
Container gets 401 from IMDS, host works | Hop limit 1 | Set HttpPutResponseHopLimit=2 |
| Account IMDSv2 default didn't affect existing instances | Default is new-launch + per-Region only | modify-instance-metadata-options per instance |
Permission denied (publickey) | Wrong user/key/permissions, or Instance Connect key expired (60s) | Correct username, chmod 400, re-run send-ssh-public-key |
| SSH broke after stop/start | Public IP changed | Attach an Elastic IP or use the new IP / DNS name |
| Charged for an unattached Elastic IP | Public IPv4 billed even when idle | Release it |
Security Considerations
Enforce IMDSv2 in the launch template (
HttpTokens=required, and hop limit 2 for containers) to block SSRF-based credential theft.Never embed secrets in user data — it's stored unencrypted, readable via IMDS, logged to cloud-init output, and recorded in the
requestParametersof theRunInstancesCloudTrail event; fetch them at boot from Secrets Manager / SSM Parameter Store (SecureString) via the instance profile.Scope security groups to least privilege — reference another security group or a specific CIDR rather than
0.0.0.0/0; the template's rules propagate to every launched instance.Encrypt EBS volumes in the block device mappings, and prefer Session Manager over SSH (no open port 22, no key sprawl).
Related
instance-selection.md — what to put in the template
auto-scaling.md — use the template in an ASG
systems-manager.md — keyless access
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