[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6NW4TR2BJFTG48830KAWKV5":3,"skill-same:01M6NW4TR2BJFTG48830KAWKV5":72},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":28,"commitSha":53,"skillDirectory":54,"forksCount":13,"repositoryHtmlUrl":55,"repositoryHomepageUrl":6,"ownerHtmlUrl":56,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":57,"install":58,"resources":71},"01M6NW4TR2BJFTG48830KAWKV5","aws-ec2",null,"Manage EC2 instances, AMIs, and auto-scaling groups. Configure security groups, key pairs, and instance types. Use when deploying compute resources on AWS.","duc-duy-1612\u002FOnline-Delivery-Systems-Web","duc-duy-1612","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F192231384?v=4","01M6NSDKQQDKVTHZ8DZMZ1VYY6","01M6NSDKW8DDVTQHBT1HBDDJPT",0,"MIT","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Faws-ec2\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"aws","ec2","aws ec2","relevant","license","types","Auto-Scaling","resources","platform","scaling","main","instances","community","manage","configure security","agent-skills","only","auto","use","devops-security","2026-11-10 10:12:30",false,"---\nname: aws-ec2\ndescription: Manage EC2 instances, AMIs, and auto-scaling groups. Configure security\n  groups, key pairs, and instance types. Use when deploying compute resources on AWS.\ncategory: devops\nrisk: critical\nsource: https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\nsource_repo: BagelHole\u002FDevOps-Security-Agent-Skills\nsource_type: community\ndate_added: '2026-09-20'\nlicense: MIT\nlicense_source: https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\u002Fblob\u002Fmain\u002FLICENSE\ncompatibility: Requires the relevant OS\u002Fplatform tooling and privileged access where\n  noted. Docs-only; helper scripts and templates not bundled.\nmetadata:\n  author: devops-skills\n  version: '1.0'\n---\n\n# AWS EC2\n\nDeploy and manage Amazon EC2 compute instances for production, staging, and development workloads.\n\n## When to Use This Skill\n\n- Launching new compute instances for application hosting\n- Building golden AMIs for consistent deployments\n- Setting up auto-scaling groups behind load balancers\n- Migrating workloads to Spot instances for cost savings\n- Troubleshooting instance connectivity, performance, or launch failures\n- Creating launch templates for repeatable infrastructure\n\n## Prerequisites\n\n- AWS CLI v2 installed and configured (`aws configure`)\n- IAM permissions: `ec2:*`, `autoscaling:*`, `elasticloadbalancing:*`, `iam:PassRole`\n- An existing VPC with subnets (see aws-vpc (`aws-vpc`))\n- SSH key pair created (`aws ec2 create-key-pair --key-name my-key --query 'KeyMaterial' --output text > my-key.pem`)\n\n## Instance Type Selection Guide\n\n| Category | Types | Use Case |\n|---|---|---|\n| General Purpose | t3, t3a, m6i, m7g | Web servers, small databases, dev\u002Ftest |\n| Compute Optimized | c6i, c7g | Batch processing, media encoding, ML inference |\n| Memory Optimized | r6i, r7g, x2idn | In-memory caches, large databases |\n| Storage Optimized | i3, i4i, d3 | Data warehousing, distributed file systems |\n| Accelerated | p4d, g5, inf2 | ML training, GPU rendering, inference |\n| Burstable | t3.micro-t3.2xlarge | Low-steady-state with occasional bursts |\n\n## Launch an Instance\n\n```bash\n# Launch a production web server\naws ec2 run-instances \\\n  --image-id ami-0abcdef1234567890 \\\n  --instance-type t3.medium \\\n  --key-name my-key \\\n  --security-group-ids sg-12345678 \\\n  --subnet-id subnet-12345678 \\\n  --iam-instance-profile Name=EC2AppProfile \\\n  --metadata-options \"HttpTokens=required,HttpEndpoint=enabled\" \\\n  --block-device-mappings '[{\n    \"DeviceName\": \"\u002Fdev\u002Fxvda\",\n    \"Ebs\": {\n      \"VolumeSize\": 30,\n      \"VolumeType\": \"gp3\",\n      \"Iops\": 3000,\n      \"Throughput\": 125,\n      \"Encrypted\": true\n    }\n  }]' \\\n  --tag-specifications 'ResourceType=instance,Tags=[\n    {Key=Name,Value=web-server-01},\n    {Key=Environment,Value=production},\n    {Key=Team,Value=platform}\n  ]' \\\n  --user-data file:\u002F\u002Fuserdata.sh\n\n# Launch with IMDSv2 required (security best practice)\naws ec2 run-instances \\\n  --image-id ami-0abcdef1234567890 \\\n  --instance-type t3.micro \\\n  --metadata-options \"HttpTokens=required,HttpPutResponseHopLimit=1,HttpEndpoint=enabled\" \\\n  --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=secure-instance}]'\n```\n\n## User Data Scripts\n\n```bash\n#!\u002Fbin\u002Fbash\n# userdata.sh - Bootstrap a web server on Amazon Linux 2023\nset -euxo pipefail\n\n# System updates\ndnf update -y\n\n# Install and start web server\ndnf install -y nginx\nsystemctl enable nginx\nsystemctl start nginx\n\n# Install CloudWatch agent\ndnf install -y amazon-cloudwatch-agent\n\u002Fopt\u002Faws\u002Famazon-cloudwatch-agent\u002Fbin\u002Famazon-cloudwatch-agent-ctl \\\n  -a fetch-config -m ec2 \\\n  -s -c ssm:AmazonCloudWatch-linux\n\n# Install CodeDeploy agent\ndnf install -y ruby wget\ncd \u002Fhome\u002Fec2-user\nwget https:\u002F\u002Faws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com\u002Flatest\u002Finstall\nchmod +x .\u002Finstall\n.\u002Finstall auto\n\n# Signal CloudFormation (if launched via CFN)\n# \u002Fopt\u002Faws\u002Fbin\u002Fcfn-signal -e $? --stack ${AWS::StackName} --resource ASG --region ${AWS::Region}\n```\n\n## Launch Templates\n\n```bash\n# Create a launch template with full configuration\naws ec2 create-launch-template \\\n  --launch-template-name web-server-template \\\n  --version-description \"v1 - AL2023 with nginx\" \\\n  --launch-template-data '{\n    \"ImageId\": \"ami-0abcdef1234567890\",\n    \"InstanceType\": \"t3.medium\",\n    \"KeyName\": \"my-key\",\n    \"SecurityGroupIds\": [\"sg-12345678\"],\n    \"IamInstanceProfile\": {\"Name\": \"EC2AppProfile\"},\n    \"MetadataOptions\": {\n      \"HttpTokens\": \"required\",\n      \"HttpEndpoint\": \"enabled\"\n    },\n    \"BlockDeviceMappings\": [{\n      \"DeviceName\": \"\u002Fdev\u002Fxvda\",\n      \"Ebs\": {\n        \"VolumeSize\": 30,\n        \"VolumeType\": \"gp3\",\n        \"Encrypted\": true\n      }\n    }],\n    \"TagSpecifications\": [{\n      \"ResourceType\": \"instance\",\n      \"Tags\": [\n        {\"Key\": \"Environment\", \"Value\": \"production\"},\n        {\"Key\": \"ManagedBy\", \"Value\": \"launch-template\"}\n      ]\n    }],\n    \"Monitoring\": {\"Enabled\": true},\n    \"UserData\": \"'\"$(base64 -w0 userdata.sh)\"'\"\n  }'\n\n# Create a new version of the launch template\naws ec2 create-launch-template-version \\\n  --launch-template-name web-server-template \\\n  --source-version 1 \\\n  --version-description \"v2 - updated AMI\" \\\n  --launch-template-data '{\"ImageId\": \"ami-0newami1234567890\"}'\n\n# Set the default version\naws ec2 modify-launch-template \\\n  --launch-template-name web-server-template \\\n  --default-version 2\n```\n\n## Auto Scaling Group\n\n```bash\n# Create ASG with mixed instances (on-demand + spot)\naws autoscaling create-auto-scaling-group \\\n  --auto-scaling-group-name web-asg \\\n  --mixed-instances-policy '{\n    \"LaunchTemplate\": {\n      \"LaunchTemplateSpecification\": {\n        \"LaunchTemplateName\": \"web-server-template\",\n        \"Version\": \"$Default\"\n      },\n      \"Overrides\": [\n        {\"InstanceType\": \"t3.medium\"},\n        {\"InstanceType\": \"t3a.medium\"},\n        {\"InstanceType\": \"m5.large\"}\n      ]\n    },\n    \"InstancesDistribution\": {\n      \"OnDemandBaseCapacity\": 2,\n      \"OnDemandPercentageAboveBaseCapacity\": 25,\n      \"SpotAllocationStrategy\": \"capacity-optimized\"\n    }\n  }' \\\n  --min-size 2 --max-size 10 --desired-capacity 4 \\\n  --vpc-zone-identifier \"subnet-aaa,subnet-bbb\" \\\n  --target-group-arns \"arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup\u002Fweb-tg\u002Fabc123\" \\\n  --health-check-type ELB \\\n  --health-check-grace-period 300 \\\n  --tags '[\n    {\"Key\":\"Name\",\"Value\":\"web-asg\",\"PropagateAtLaunch\":true},\n    {\"Key\":\"Environment\",\"Value\":\"production\",\"PropagateAtLaunch\":true}\n  ]'\n\n# Create target tracking scaling policy (target 60% CPU)\naws autoscaling put-scaling-policy \\\n  --auto-scaling-group-name web-asg \\\n  --policy-name cpu-target-tracking \\\n  --policy-type TargetTrackingScaling \\\n  --target-tracking-configuration '{\n    \"PredefinedMetricSpecification\": {\n      \"PredefinedMetricType\": \"ASGAverageCPUUtilization\"\n    },\n    \"TargetValue\": 60.0,\n    \"ScaleInCooldown\": 300,\n    \"ScaleOutCooldown\": 60\n  }'\n\n# Create scheduled scaling for known traffic patterns\naws autoscaling put-scheduled-update-group-action \\\n  --auto-scaling-group-name web-asg \\\n  --scheduled-action-name scale-up-morning \\\n  --recurrence \"0 8 * * MON-FRI\" \\\n  --min-size 4 --max-size 20 --desired-capacity 8\n\naws autoscaling put-scheduled-update-group-action \\\n  --auto-scaling-group-name web-asg \\\n  --scheduled-action-name scale-down-evening \\\n  --recurrence \"0 20 * * MON-FRI\" \\\n  --min-size 2 --max-size 10 --desired-capacity 2\n```\n\n## Spot Instances\n\n```bash\n# Request Spot instances\naws ec2 request-spot-instances \\\n  --spot-price \"0.05\" \\\n  --instance-count 3 \\\n  --type \"one-time\" \\\n  --launch-specification '{\n    \"ImageId\": \"ami-0abcdef1234567890\",\n    \"InstanceType\": \"c5.xlarge\",\n    \"KeyName\": \"my-key\",\n    \"SecurityGroupIds\": [\"sg-12345678\"],\n    \"SubnetId\": \"subnet-12345678\"\n  }'\n\n# Check current Spot prices\naws ec2 describe-spot-price-history \\\n  --instance-types t3.medium t3a.medium m5.large \\\n  --availability-zone us-east-1a \\\n  --product-descriptions \"Linux\u002FUNIX\" \\\n  --start-time \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\" \\\n  --query \"SpotPriceHistory[].{Type:InstanceType,Price:SpotPrice,AZ:AvailabilityZone}\" \\\n  --output table\n\n# Create a Spot Fleet request\naws ec2 request-spot-fleet \\\n  --spot-fleet-request-config '{\n    \"IamFleetRole\": \"arn:aws:iam::123456789012:role\u002Faws-ec2-spot-fleet-role\",\n    \"TargetCapacity\": 10,\n    \"SpotPrice\": \"0.10\",\n    \"AllocationStrategy\": \"capacityOptimized\",\n    \"LaunchSpecifications\": [\n      {\"ImageId\": \"ami-xxx\", \"InstanceType\": \"c5.xlarge\", \"SubnetId\": \"subnet-aaa\"},\n      {\"ImageId\": \"ami-xxx\", \"InstanceType\": \"c5a.xlarge\", \"SubnetId\": \"subnet-bbb\"}\n    ]\n  }'\n```\n\n## AMI Management\n\n```bash\n# Create an AMI from a running instance\naws ec2 create-image \\\n  --instance-id i-0abc123def456 \\\n  --name \"web-server-$(date +%Y%m%d)\" \\\n  --description \"Web server golden AMI\" \\\n  --no-reboot \\\n  --tag-specifications 'ResourceType=image,Tags=[\n    {Key=Name,Value=web-server-golden},\n    {Key=Version,Value=2026.03.24}\n  ]'\n\n# Copy AMI to another region for disaster recovery\naws ec2 copy-image \\\n  --source-image-id ami-0abcdef1234567890 \\\n  --source-region us-east-1 \\\n  --region us-west-2 \\\n  --name \"web-server-dr-copy\"\n\n# Deregister old AMIs and delete associated snapshots\naws ec2 deregister-image --image-id ami-old123\naws ec2 delete-snapshot --snapshot-id snap-old123\n\n# Share AMI with another AWS account\naws ec2 modify-image-attribute \\\n  --image-id ami-0abcdef1234567890 \\\n  --launch-permission \"Add=[{UserId=987654321098}]\"\n```\n\n## Instance Management\n\n```bash\n# List running instances with key details\naws ec2 describe-instances \\\n  --filters \"Name=instance-state-name,Values=running\" \\\n  --query \"Reservations[].Instances[].{ID:InstanceId,Type:InstanceType,IP:PrivateIpAddress,Name:Tags[?Key=='Name']|[0].Value,State:State.Name}\" \\\n  --output table\n\n# Stop and start instances\naws ec2 stop-instances --instance-ids i-0abc123def456\naws ec2 start-instances --instance-ids i-0abc123def456\n\n# Resize an instance (stop first)\naws ec2 stop-instances --instance-ids i-0abc123def456\naws ec2 wait instance-stopped --instance-ids i-0abc123def456\naws ec2 modify-instance-attribute \\\n  --instance-id i-0abc123def456 \\\n  --instance-type '{\"Value\": \"t3.large\"}'\naws ec2 start-instances --instance-ids i-0abc123def456\n\n# Get console output for debugging boot issues\naws ec2 get-console-output --instance-id i-0abc123def456\n\n# Get instance screenshot (helps debug GUI issues)\naws ec2 get-console-screenshot --instance-id i-0abc123def456\n```\n\n## Terraform EC2 with Auto Scaling\n\n```hcl\nresource \"aws_launch_template\" \"web\" {\n  name_prefix   = \"web-\"\n  image_id      = data.aws_ami.amazon_linux.id\n  instance_type = \"t3.medium\"\n\n  iam_instance_profile {\n    name = aws_iam_instance_profile.web.name\n  }\n\n  metadata_options {\n    http_tokens   = \"required\"\n    http_endpoint = \"enabled\"\n  }\n\n  block_device_mappings {\n    device_name = \"\u002Fdev\u002Fxvda\"\n    ebs {\n      volume_size = 30\n      volume_type = \"gp3\"\n      encrypted   = true\n    }\n  }\n\n  user_data = base64encode(file(\"userdata.sh\"))\n\n  tag_specifications {\n    resource_type = \"instance\"\n    tags = {\n      Name        = \"web-server\"\n      Environment = \"production\"\n    }\n  }\n}\n\nresource \"aws_autoscaling_group\" \"web\" {\n  name                = \"web-asg\"\n  min_size            = 2\n  max_size            = 10\n  desired_capacity    = 4\n  vpc_zone_identifier = [aws_subnet.private_a.id, aws_subnet.private_b.id]\n  target_group_arns   = [aws_lb_target_group.web.arn]\n  health_check_type   = \"ELB\"\n\n  launch_template {\n    id      = aws_launch_template.web.id\n    version = \"$Latest\"\n  }\n\n  tag {\n    key                 = \"Name\"\n    value               = \"web-asg\"\n    propagate_at_launch = true\n  }\n}\n\nresource \"aws_autoscaling_policy\" \"cpu\" {\n  name                   = \"cpu-target-tracking\"\n  autoscaling_group_name = aws_autoscaling_group.web.name\n  policy_type            = \"TargetTrackingScaling\"\n\n  target_tracking_configuration {\n    predefined_metric_specification {\n      predefined_metric_type = \"ASGAverageCPUUtilization\"\n    }\n    target_value = 60.0\n  }\n}\n```\n\n## Troubleshooting\n\n| Problem | Cause | Fix |\n|---|---|---|\n| Instance stuck in `pending` | Insufficient capacity | Try a different AZ or instance type |\n| Cannot SSH to instance | Security group or NACL blocks port 22 | Check SG ingress rules and route tables |\n| Instance immediately terminates | EBS volume limit or AMI issue | Check `describe-instances` for StateReason |\n| IMDSv1 deprecation warnings | Metadata options not set | Set `HttpTokens=required` in launch template |\n| User data not running | Script missing shebang or not base64 | Verify `#!\u002Fbin\u002Fbash` header; check `\u002Fvar\u002Flog\u002Fcloud-init-output.log` |\n| Spot instance terminated | Capacity reclaimed by AWS | Use capacity-optimized allocation and diversify types |\n| ASG not replacing unhealthy | Health check grace period too short | Increase grace period to cover app boot time |\n| EBS throughput bottleneck | gp2 volume too small for IOPS | Migrate to gp3 and set explicit IOPS\u002Fthroughput |\n\n## Related Skills\n\n- aws-vpc (`aws-vpc`) - VPC networking, subnets, and security groups\n- aws-iam (`aws-iam`) - Instance profiles and roles\n- aws-cost-optimization (`aws-cost-optimization`) - Rightsizing and Spot strategies\n- terraform-aws (`terraform-aws`) - Infrastructure as Code deployment\n- cloudformation (`cloudformation`) - AWS-native IaC templates\n\n## Limitations\n\n- Infrastructure commands can disrupt services: confirm target host\u002Fscope and have backups\u002Fsnapshots before mutating state.\n- Docs-only import: upstream scripts and templates not bundled.\n\n","# AWS EC2\n\nDeploy and manage Amazon EC2 compute instances for production, staging, and development workloads.\n\n## When to Use This Skill\n\n- Launching new compute instances for application hosting\n- Building golden AMIs for consistent deployments\n- Setting up auto-scaling groups behind load balancers\n- Migrating workloads to Spot instances for cost savings\n- Troubleshooting instance connectivity, performance, or launch failures\n- Creating launch templates for repeatable infrastructure\n\n## Prerequisites\n\n- AWS CLI v2 installed and configured (`aws configure`)\n- IAM permissions: `ec2:*`, `autoscaling:*`, `elasticloadbalancing:*`, `iam:PassRole`\n- An existing VPC with subnets (see aws-vpc (`aws-vpc`))\n- SSH key pair created (`aws ec2 create-key-pair --key-name my-key --query 'KeyMaterial' --output text > my-key.pem`)\n\n## Instance Type Selection Guide\n\n| Category | Types | Use Case |\n|---|---|---|\n| General Purpose | t3, t3a, m6i, m7g | Web servers, small databases, dev\u002Ftest |\n| Compute Optimized | c6i, c7g | Batch processing, media encoding, ML inference |\n| Memory Optimized | r6i, r7g, x2idn | In-memory caches, large databases |\n| Storage Optimized | i3, i4i, d3 | Data warehousing, distributed file systems |\n| Accelerated | p4d, g5, inf2 | ML training, GPU rendering, inference |\n| Burstable | t3.micro-t3.2xlarge | Low-steady-state with occasional bursts |\n\n## Launch an Instance\n\n```bash\n# Launch a production web server\naws ec2 run-instances \\\n  --image-id ami-0abcdef1234567890 \\\n  --instance-type t3.medium \\\n  --key-name my-key \\\n  --security-group-ids sg-12345678 \\\n  --subnet-id subnet-12345678 \\\n  --iam-instance-profile Name=EC2AppProfile \\\n  --metadata-options \"HttpTokens=required,HttpEndpoint=enabled\" \\\n  --block-device-mappings '[{\n    \"DeviceName\": \"\u002Fdev\u002Fxvda\",\n    \"Ebs\": {\n      \"VolumeSize\": 30,\n      \"VolumeType\": \"gp3\",\n      \"Iops\": 3000,\n      \"Throughput\": 125,\n      \"Encrypted\": true\n    }\n  }]' \\\n  --tag-specifications 'ResourceType=instance,Tags=[\n    {Key=Name,Value=web-server-01},\n    {Key=Environment,Value=production},\n    {Key=Team,Value=platform}\n  ]' \\\n  --user-data file:\u002F\u002Fuserdata.sh\n\n# Launch with IMDSv2 required (security best practice)\naws ec2 run-instances \\\n  --image-id ami-0abcdef1234567890 \\\n  --instance-type t3.micro \\\n  --metadata-options \"HttpTokens=required,HttpPutResponseHopLimit=1,HttpEndpoint=enabled\" \\\n  --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=secure-instance}]'\n```\n\n## User Data Scripts\n\n```bash\n#!\u002Fbin\u002Fbash\n# userdata.sh - Bootstrap a web server on Amazon Linux 2023\nset -euxo pipefail\n\n# System updates\ndnf update -y\n\n# Install and start web server\ndnf install -y nginx\nsystemctl enable nginx\nsystemctl start nginx\n\n# Install CloudWatch agent\ndnf install -y amazon-cloudwatch-agent\n\u002Fopt\u002Faws\u002Famazon-cloudwatch-agent\u002Fbin\u002Famazon-cloudwatch-agent-ctl \\\n  -a fetch-config -m ec2 \\\n  -s -c ssm:AmazonCloudWatch-linux\n\n# Install CodeDeploy agent\ndnf install -y ruby wget\ncd \u002Fhome\u002Fec2-user\nwget https:\u002F\u002Faws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com\u002Flatest\u002Finstall\nchmod +x .\u002Finstall\n.\u002Finstall auto\n\n# Signal CloudFormation (if launched via CFN)\n# \u002Fopt\u002Faws\u002Fbin\u002Fcfn-signal -e $? --stack ${AWS::StackName} --resource ASG --region ${AWS::Region}\n```\n\n## Launch Templates\n\n```bash\n# Create a launch template with full configuration\naws ec2 create-launch-template \\\n  --launch-template-name web-server-template \\\n  --version-description \"v1 - AL2023 with nginx\" \\\n  --launch-template-data '{\n    \"ImageId\": \"ami-0abcdef1234567890\",\n    \"InstanceType\": \"t3.medium\",\n    \"KeyName\": \"my-key\",\n    \"SecurityGroupIds\": [\"sg-12345678\"],\n    \"IamInstanceProfile\": {\"Name\": \"EC2AppProfile\"},\n    \"MetadataOptions\": {\n      \"HttpTokens\": \"required\",\n      \"HttpEndpoint\": \"enabled\"\n    },\n    \"BlockDeviceMappings\": [{\n      \"DeviceName\": \"\u002Fdev\u002Fxvda\",\n      \"Ebs\": {\n        \"VolumeSize\": 30,\n        \"VolumeType\": \"gp3\",\n        \"Encrypted\": true\n      }\n    }],\n    \"TagSpecifications\": [{\n      \"ResourceType\": \"instance\",\n      \"Tags\": [\n        {\"Key\": \"Environment\", \"Value\": \"production\"},\n        {\"Key\": \"ManagedBy\", \"Value\": \"launch-template\"}\n      ]\n    }],\n    \"Monitoring\": {\"Enabled\": true},\n    \"UserData\": \"'\"$(base64 -w0 userdata.sh)\"'\"\n  }'\n\n# Create a new version of the launch template\naws ec2 create-launch-template-version \\\n  --launch-template-name web-server-template \\\n  --source-version 1 \\\n  --version-description \"v2 - updated AMI\" \\\n  --launch-template-data '{\"ImageId\": \"ami-0newami1234567890\"}'\n\n# Set the default version\naws ec2 modify-launch-template \\\n  --launch-template-name web-server-template \\\n  --default-version 2\n```\n\n## Auto Scaling Group\n\n```bash\n# Create ASG with mixed instances (on-demand + spot)\naws autoscaling create-auto-scaling-group \\\n  --auto-scaling-group-name web-asg \\\n  --mixed-instances-policy '{\n    \"LaunchTemplate\": {\n      \"LaunchTemplateSpecification\": {\n        \"LaunchTemplateName\": \"web-server-template\",\n        \"Version\": \"$Default\"\n      },\n      \"Overrides\": [\n        {\"InstanceType\": \"t3.medium\"},\n        {\"InstanceType\": \"t3a.medium\"},\n        {\"InstanceType\": \"m5.large\"}\n      ]\n    },\n    \"InstancesDistribution\": {\n      \"OnDemandBaseCapacity\": 2,\n      \"OnDemandPercentageAboveBaseCapacity\": 25,\n      \"SpotAllocationStrategy\": \"capacity-optimized\"\n    }\n  }' \\\n  --min-size 2 --max-size 10 --desired-capacity 4 \\\n  --vpc-zone-identifier \"subnet-aaa,subnet-bbb\" \\\n  --target-group-arns \"arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup\u002Fweb-tg\u002Fabc123\" \\\n  --health-check-type ELB \\\n  --health-check-grace-period 300 \\\n  --tags '[\n    {\"Key\":\"Name\",\"Value\":\"web-asg\",\"PropagateAtLaunch\":true},\n    {\"Key\":\"Environment\",\"Value\":\"production\",\"PropagateAtLaunch\":true}\n  ]'\n\n# Create target tracking scaling policy (target 60% CPU)\naws autoscaling put-scaling-policy \\\n  --auto-scaling-group-name web-asg \\\n  --policy-name cpu-target-tracking \\\n  --policy-type TargetTrackingScaling \\\n  --target-tracking-configuration '{\n    \"PredefinedMetricSpecification\": {\n      \"PredefinedMetricType\": \"ASGAverageCPUUtilization\"\n    },\n    \"TargetValue\": 60.0,\n    \"ScaleInCooldown\": 300,\n    \"ScaleOutCooldown\": 60\n  }'\n\n# Create scheduled scaling for known traffic patterns\naws autoscaling put-scheduled-update-group-action \\\n  --auto-scaling-group-name web-asg \\\n  --scheduled-action-name scale-up-morning \\\n  --recurrence \"0 8 * * MON-FRI\" \\\n  --min-size 4 --max-size 20 --desired-capacity 8\n\naws autoscaling put-scheduled-update-group-action \\\n  --auto-scaling-group-name web-asg \\\n  --scheduled-action-name scale-down-evening \\\n  --recurrence \"0 20 * * MON-FRI\" \\\n  --min-size 2 --max-size 10 --desired-capacity 2\n```\n\n## Spot Instances\n\n```bash\n# Request Spot instances\naws ec2 request-spot-instances \\\n  --spot-price \"0.05\" \\\n  --instance-count 3 \\\n  --type \"one-time\" \\\n  --launch-specification '{\n    \"ImageId\": \"ami-0abcdef1234567890\",\n    \"InstanceType\": \"c5.xlarge\",\n    \"KeyName\": \"my-key\",\n    \"SecurityGroupIds\": [\"sg-12345678\"],\n    \"SubnetId\": \"subnet-12345678\"\n  }'\n\n# Check current Spot prices\naws ec2 describe-spot-price-history \\\n  --instance-types t3.medium t3a.medium m5.large \\\n  --availability-zone us-east-1a \\\n  --product-descriptions \"Linux\u002FUNIX\" \\\n  --start-time \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\" \\\n  --query \"SpotPriceHistory[].{Type:InstanceType,Price:SpotPrice,AZ:AvailabilityZone}\" \\\n  --output table\n\n# Create a Spot Fleet request\naws ec2 request-spot-fleet \\\n  --spot-fleet-request-config '{\n    \"IamFleetRole\": \"arn:aws:iam::123456789012:role\u002Faws-ec2-spot-fleet-role\",\n    \"TargetCapacity\": 10,\n    \"SpotPrice\": \"0.10\",\n    \"AllocationStrategy\": \"capacityOptimized\",\n    \"LaunchSpecifications\": [\n      {\"ImageId\": \"ami-xxx\", \"InstanceType\": \"c5.xlarge\", \"SubnetId\": \"subnet-aaa\"},\n      {\"ImageId\": \"ami-xxx\", \"InstanceType\": \"c5a.xlarge\", \"SubnetId\": \"subnet-bbb\"}\n    ]\n  }'\n```\n\n## AMI Management\n\n```bash\n# Create an AMI from a running instance\naws ec2 create-image \\\n  --instance-id i-0abc123def456 \\\n  --name \"web-server-$(date +%Y%m%d)\" \\\n  --description \"Web server golden AMI\" \\\n  --no-reboot \\\n  --tag-specifications 'ResourceType=image,Tags=[\n    {Key=Name,Value=web-server-golden},\n    {Key=Version,Value=2026.03.24}\n  ]'\n\n# Copy AMI to another region for disaster recovery\naws ec2 copy-image \\\n  --source-image-id ami-0abcdef1234567890 \\\n  --source-region us-east-1 \\\n  --region us-west-2 \\\n  --name \"web-server-dr-copy\"\n\n# Deregister old AMIs and delete associated snapshots\naws ec2 deregister-image --image-id ami-old123\naws ec2 delete-snapshot --snapshot-id snap-old123\n\n# Share AMI with another AWS account\naws ec2 modify-image-attribute \\\n  --image-id ami-0abcdef1234567890 \\\n  --launch-permission \"Add=[{UserId=987654321098}]\"\n```\n\n## Instance Management\n\n```bash\n# List running instances with key details\naws ec2 describe-instances \\\n  --filters \"Name=instance-state-name,Values=running\" \\\n  --query \"Reservations[].Instances[].{ID:InstanceId,Type:InstanceType,IP:PrivateIpAddress,Name:Tags[?Key=='Name']|[0].Value,State:State.Name}\" \\\n  --output table\n\n# Stop and start instances\naws ec2 stop-instances --instance-ids i-0abc123def456\naws ec2 start-instances --instance-ids i-0abc123def456\n\n# Resize an instance (stop first)\naws ec2 stop-instances --instance-ids i-0abc123def456\naws ec2 wait instance-stopped --instance-ids i-0abc123def456\naws ec2 modify-instance-attribute \\\n  --instance-id i-0abc123def456 \\\n  --instance-type '{\"Value\": \"t3.large\"}'\naws ec2 start-instances --instance-ids i-0abc123def456\n\n# Get console output for debugging boot issues\naws ec2 get-console-output --instance-id i-0abc123def456\n\n# Get instance screenshot (helps debug GUI issues)\naws ec2 get-console-screenshot --instance-id i-0abc123def456\n```\n\n## Terraform EC2 with Auto Scaling\n\n```hcl\nresource \"aws_launch_template\" \"web\" {\n  name_prefix   = \"web-\"\n  image_id      = data.aws_ami.amazon_linux.id\n  instance_type = \"t3.medium\"\n\n  iam_instance_profile {\n    name = aws_iam_instance_profile.web.name\n  }\n\n  metadata_options {\n    http_tokens   = \"required\"\n    http_endpoint = \"enabled\"\n  }\n\n  block_device_mappings {\n    device_name = \"\u002Fdev\u002Fxvda\"\n    ebs {\n      volume_size = 30\n      volume_type = \"gp3\"\n      encrypted   = true\n    }\n  }\n\n  user_data = base64encode(file(\"userdata.sh\"))\n\n  tag_specifications {\n    resource_type = \"instance\"\n    tags = {\n      Name        = \"web-server\"\n      Environment = \"production\"\n    }\n  }\n}\n\nresource \"aws_autoscaling_group\" \"web\" {\n  name                = \"web-asg\"\n  min_size            = 2\n  max_size            = 10\n  desired_capacity    = 4\n  vpc_zone_identifier = [aws_subnet.private_a.id, aws_subnet.private_b.id]\n  target_group_arns   = [aws_lb_target_group.web.arn]\n  health_check_type   = \"ELB\"\n\n  launch_template {\n    id      = aws_launch_template.web.id\n    version = \"$Latest\"\n  }\n\n  tag {\n    key                 = \"Name\"\n    value               = \"web-asg\"\n    propagate_at_launch = true\n  }\n}\n\nresource \"aws_autoscaling_policy\" \"cpu\" {\n  name                   = \"cpu-target-tracking\"\n  autoscaling_group_name = aws_autoscaling_group.web.name\n  policy_type            = \"TargetTrackingScaling\"\n\n  target_tracking_configuration {\n    predefined_metric_specification {\n      predefined_metric_type = \"ASGAverageCPUUtilization\"\n    }\n    target_value = 60.0\n  }\n}\n```\n\n## Troubleshooting\n\n| Problem | Cause | Fix |\n|---|---|---|\n| Instance stuck in `pending` | Insufficient capacity | Try a different AZ or instance type |\n| Cannot SSH to instance | Security group or NACL blocks port 22 | Check SG ingress rules and route tables |\n| Instance immediately terminates | EBS volume limit or AMI issue | Check `describe-instances` for StateReason |\n| IMDSv1 deprecation warnings | Metadata options not set | Set `HttpTokens=required` in launch template |\n| User data not running | Script missing shebang or not base64 | Verify `#!\u002Fbin\u002Fbash` header; check `\u002Fvar\u002Flog\u002Fcloud-init-output.log` |\n| Spot instance terminated | Capacity reclaimed by AWS | Use capacity-optimized allocation and diversify types |\n| ASG not replacing unhealthy | Health check grace period too short | Increase grace period to cover app boot time |\n| EBS throughput bottleneck | gp2 volume too small for IOPS | Migrate to gp3 and set explicit IOPS\u002Fthroughput |\n\n## Related Skills\n\n- aws-vpc (`aws-vpc`) - VPC networking, subnets, and security groups\n- aws-iam (`aws-iam`) - Instance profiles and roles\n- aws-cost-optimization (`aws-cost-optimization`) - Rightsizing and Spot strategies\n- terraform-aws (`terraform-aws`) - Infrastructure as Code deployment\n- cloudformation (`cloudformation`) - AWS-native IaC templates\n\n## Limitations\n\n- Infrastructure commands can disrupt services: confirm target host\u002Fscope and have backups\u002Fsnapshots before mutating state.\n- Docs-only import: upstream scripts and templates not bundled.\n\n",{"name":5,"risk":43,"source":44,"license":14,"category":45,"metadata":46,"date_added":49,"description":7,"source_repo":50,"source_type":30,"compatibility":51,"license_source":52},"critical","https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills","devops",{"author":47,"version":48},"devops-skills","1.0","2026-09-20","BagelHole\u002FDevOps-Security-Agent-Skills","Requires the relevant OS\u002Fplatform tooling and privileged access where noted. Docs-only; helper scripts and templates not bundled.","https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\u002Fblob\u002Fmain\u002FLICENSE","f3312ba749561b6159f477dbfc9313c875d40a56",".agents\u002Fskills_archive\u002Faws-ec2","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612","2026-10-25 23:50:58",{"source":8,"skillName":5,"commands":59,"prompt":69,"zipAvailable":70},[60,63,66],{"tool":61,"command":62},"npx","npx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill aws-ec2",{"tool":64,"command":65},"bunx","bunx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill aws-ec2",{"tool":67,"command":68},"pnpm","pnpm dlx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill aws-ec2","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Faws-ec2\u002FSKILL.md",true,[],[73,98,122,146,174,198],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":84,"publishedAt":38},"01M6Q0FA5FZ410Z33Z3TFQ4DBA","zero-trust","Implement zero-trust network architecture. Configure identity-based access, micro-segmentation, and continuous verification. Use when implementing modern security architectures.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzero-trust\u002FSKILL.md",[79],{"categoryNo":80,"categoryName":81,"taxonomyType":82,"taxonomyTypeDesc":83},"01JBSEEDCAT000000000000011","运维与部署","SCENARIO","使用场景",[85,86,87,88,89,90,75,91,37,92,93,34,30,28,94,43,95,96,21,97],"ZeRO","trust","zero trust","architecture","assessment","verification","segmentation","access","configure","active","scope","scripts","implementing",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":38},"01M6Q0F1YZJW3KX5FBKEVZ8CV4","zcode-delegate","Delegate coding tasks to the Z.AI ZCode CLI only when the user explicitly requests it, while the orchestrator retains review and landing responsibility.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzcode-delegate\u002FSKILL.md",[],[105,106,107,108,109,110,111,112,113,114,115,116,117,34,118,30,119,120,43,121],"delegate","zcode","zcode delegate","review","cli","orchestration","tasks","run","Bash","model","node","read","orchestrator","files","desktop app","app","agent-orchestration",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":38},"01M6Q0ETK41VGNMYEXW0T00AJN","youtube-transcript","Fetch YouTube transcripts through DeepAPI or local fallback tooling and save clean text output.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript\u002FSKILL.md",[],[129,130,131,132,133,134,135,22,136,137,138,139,140,30,28,141,142,143,144,145],"transcript","youtube transcript","youtube","safe","github","codex","research","https","text","fetch","tooling","clean","local","output","deepapi","youtube transcripts","blob",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":163,"publishedAt":38},"01M6Q0EPPH2PVMDW40017F8WX0","youtube-transcript-skills","Fetch YouTube video transcripts, search videos\u002Fchannels, browse channels, and extract playlists via the getyoutubetranscript.com API - free tier, no card required.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript-skills\u002FSKILL.md",[152,155,158],{"categoryNo":153,"categoryName":154,"taxonomyType":82,"taxonomyTypeDesc":83},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":156,"categoryName":157,"taxonomyType":82,"taxonomyTypeDesc":83},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":159,"categoryName":160,"taxonomyType":161,"taxonomyTypeDesc":162},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[129,130,131,164,132,165,133,134,22,166,167,168,169,138,170,30,28,171,172,173],"youtube transcript skills","gemini","search","api","Video","browse","api-integration","free","card","channels",{"skillNo":175,"name":176,"nameZh":6,"description":177,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":178,"categories":179,"keywords":184,"publishedAt":38},"01M6Q0EAB96PX83W5PTE8A0R8D","youtube-notetaker","Turn YouTube talks into local study notes with slides, transcripts, editable annotations, and a markdown-backed viewer.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-notetaker\u002FSKILL.md",[180,183],{"categoryNo":181,"categoryName":182,"taxonomyType":82,"taxonomyTypeDesc":83},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":156,"categoryName":157,"taxonomyType":82,"taxonomyTypeDesc":83},[131,185,186,109,132,187,188,189,190,22,168,191,192,193,194,28,195,141,196,197],"youtube notetaker","notetaker","workflow","official","notes","code","markdown","slides","annotations","README","study","dair-academy","viewer",{"skillNo":199,"name":200,"nameZh":6,"description":201,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":202,"categories":203,"keywords":205,"publishedAt":38},"01M6Q0E55F0GW5MX48V8HXS8B5","youtube-full","Fetch YouTube transcripts, search videos, browse channels, and extract playlists via TranscriptAPI — no yt-dlp, no Google API key, works from any cloud server.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-full\u002FSKILL.md",[204],{"categoryNo":153,"categoryName":154,"taxonomyType":82,"taxonomyTypeDesc":83},[206,131,207,208,132,165,166,209,210,167,168,169,138,211,170,30,28,171,212,144],"youtube full","full","google","server","dlp","credits","automatic"]