Skip to content
aws-ec2-deployment logo

AWS EC2 Deployment Skill

aws-ec2-deployment

Launch, configure, and manage EC2 instances with best practices

SKILL.md

Full skill instructions

AWS EC2 Deployment Skill

Deploy and manage EC2 instances with production-ready configurations.

Quick Reference

AttributeValue
AWS ServiceEC2
ComplexityMedium
Est. Time5-15 min
PrerequisitesVPC, Security Group, Key Pair

Parameters

Required

ParameterTypeDescriptionValidation
instance_typestringEC2 instance typeValid type (m6i.large)
ami_idstringAMI IDami-[a-z0-9]{17}
subnet_idstringTarget subnetsubnet-[a-z0-9]{17}
security_group_idsarraySecurity groupsNon-empty array

Optional

ParameterTypeDefaultDescription
key_namestringnullSSH key pair name
iam_instance_profilestringnullIAM role ARN
user_datastringnullBase64 startup script
ebs_optimizedbooltrueEBS optimization
monitoringbooltrueDetailed monitoring

Implementation

Launch Instance

aws ec2 run-instances \
  --image-id ami-0abcdef1234567890 \
  --instance-type m6i.large \
  --subnet-id subnet-12345678 \
  --security-group-ids sg-12345678 \
  --key-name my-key \
  --iam-instance-profile Name=MyRole \
  --ebs-optimized \
  --monitoring Enabled=true \
  --metadata-options HttpTokens=required \
  --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=MyServer}]'

User Data Script

#!/​bin/​bash
set -e
yum update -y
yum install -y docker
systemctl enable docker
systemctl start docker

Retry Logic

def launch_with_retry(params, max_retries=3):
    for attempt in range(max_retries):
        try:
            return ec2.run_instances(**params)
        except ec2.exceptions.InsufficientInstanceCapacity:
            params['SubnetId'] = get_alternate_subnet()
            time.sleep(2 ** attempt)
    raise Exception("Failed to launch instance")

Troubleshooting

Common Issues

SymptomCauseSolution
InsufficientInstanceCapacityAZ fullTry different AZ
InvalidAMIIDAMI not in regionCopy AMI
UnauthorizedIAM missingCheck permissions
Pending foreverENI issueCheck subnet IPs

Debug Checklist

  • AMI exists in target region?
  • Subnet has available IPs?
  • Security group allows traffic?
  • Key pair exists?
  • IMDSv2 configured?

Instance Selection Guide

WorkloadFamilyKey Feature
Web/​APIM6i, M7gBalanced
ComputeC6i, C7gHigh CPU
MemoryR6i, X2idnHigh memory
GPU/​MLP4d, G5NVIDIA GPU

Cost Optimization

StrategySavings
Reserved Instances30-60%
Savings Plans30-72%
Spot InstancesUp to 90%
Right-sizing10-50%

Test Template

def test_ec2_launch():
    # Arrange
    params = {
        "ImageId": get_latest_amazon_linux_ami(),
        "InstanceType": "t3.micro",
        "MaxCount": 1, "MinCount": 1
    }

    # Act
    response = ec2.run_instances(**params)
    instance_id = response['Instances'][0]['InstanceId']

    # Assert
    waiter = ec2.get_waiter('instance_running')
    waiter.wait(InstanceIds=[instance_id])

    # Cleanup
    ec2.terminate_instances(InstanceIds=[instance_id])

Assets

  • assets/​ec2-userdata.sh - Sample user data script

References

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
Imagica logo
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View