Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

aws-ec2

БесплатноБез исполняемых скриптовНе проверен

Amazon EC2 provides resizable virtual servers on AWS. Use this skill to launch and manage EC2 instances with the AWS CLI: pick a current AMI, set up security…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub14 установок в других каталогах

Об этом скилле

AWS EC2

Overview

Amazon Elastic Compute Cloud (EC2) rents virtual servers by the second. This skill covers the everyday AWS CLI v2 workflow: launch, bootstrap, resize, snapshot, scale out and run Spot capacity. Commands assume credentials are already configured (AWS_PROFILE or an SSO session) and a default region is set.

Core objects: an instance (virtual server of a given instance type), an AMI (the image it boots from), a security group (stateful firewall), a key pair or SSM Session Manager for access, EBS volumes (persistent block storage), and a launch template (a versioned launch recipe used by Auto Scaling).

Instructions

1. Pick a current AMI

Do not copy AMI IDs from tutorials: they are region-specific and go stale. Resolve the latest Amazon Linux 2023 image from the public SSM parameter, either directly in --image-id or ahead of time:

aws ssm get-parameter \
  --name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64 \
  --query Parameter.Value --output text

2. Launch

--image-id resolve:ssm:<parameter> makes run-instances look the AMI up at launch time. Require IMDSv2 with --metadata-options so a server-side request forgery bug cannot read instance credentials with a plain GET.

aws ec2 run-instances \
  --image-id resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64 \
  --instance-type t3.small \
  --key-name deploy-key \
  --security-group-ids sg-0123456789abcdef0 \
  --subnet-id subnet-0123456789abcdef0 \
  --iam-instance-profile Name=ec2-app-role \
  --metadata-options HttpTokens=required,HttpEndpoint=enabled \
  --user-data file://setup.sh \
  --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=app-server},{Key=Env,Value=prod}]'

A bootstrap script (the shebang must be the first line). Amazon Linux 2023 uses dnf, not the old yum workflow of Amazon Linux 2:

#!/bin/bash
dnf update -y
dnf install -y docker
systemctl enable --now docker
docker run -d --restart unless-stopped -p 80:80 nginx:1.27

3. Inspect and manage

aws ec2 describe-instances \
  --filters "Name=instance-state-name,Values=running" \
  --query 'Reservations[].Instances[].[InstanceId,InstanceType,PublicIpAddress,Tags[?Key==`Name`].Value|[0]]' \
  --output table

aws ec2 stop-instances --instance-ids i-0123456789abcdef0
aws ec2 start-instances --instance-ids i-0123456789abcdef0
aws ec2 terminate-instances --instance-ids i-0123456789abcdef0   # irreversible

Resize an EBS-backed instance: stop it, change the type, start it. The public IPv4 changes unless you use an Elastic IP.

aws ec2 stop-instances --instance-ids i-0123456789abcdef0
aws ec2 wait instance-stopped --instance-ids i-0123456789abcdef0
aws ec2 modify-instance-attribute --instance-id i-0123456789abcdef0 --instance-type '{"Value": "t3.large"}'
aws ec2 start-instances --instance-ids i-0123456789abcdef0

4. Security groups

Keep SSH closed to the world; allow it from a known CIDR only, or use SSM Session Manager and open no port at all.

aws ec2 create-security-group --group-name web-sg \
  --description "HTTP, HTTPS, office SSH" --vpc-id vpc-0123456789abcdef0

aws ec2 authorize-security-group-ingress --group-id sg-0123456789abcdef0 \
  --ip-permissions \
    'IpProtocol=tcp,FromPort=80,ToPort=80,IpRanges=[{CidrIp=0.0.0.0/0}]' \
    'IpProtocol=tcp,FromPort=443,ToPort=443,IpRanges=[{CidrIp=0.0.0.0/0}]' \
    'IpProtocol=tcp,FromPort=22,ToPort=22,IpRanges=[{CidrIp=203.0.113.0/24,Description=Office}]'

5. AMIs, EBS volumes and snapshots

aws ec2 create-image --instance-id i-0123456789abcdef0 \
  --name "app-server-v1.2.0-$(date +%Y%m%d)" --description "App server with latest patches" --no-reboot
aws ec2 describe-images --owners self --query 'Images[*].[ImageId,Name,CreationDate]' --output table

aws ec2 create-volume --size 100 --volume-type gp3 --iops 3000 --throughput 125 \
  --availability-zone us-east-1a \
  --tag-specifications 'ResourceType=volume,Tags=[{Key=Name,Value=data-vol}]'
aws ec2 attach-volume --volume-id vol-0123456789abcdef0 --instance-id i-0123456789abcdef0 --device /dev/sdf
aws ec2 create-snapshot --volume-id vol-0123456789abcdef0 --description "Daily backup $(date +%F)"

--no-reboot skips the reboot but the filesystem may be captured inconsistent; omit it for databases. To retire an AMI, aws ec2 deregister-image --image-id ami-... and then delete its snapshots separately with delete-snapshot. The volume and instance must be in the same Availability Zone.

6. Launch template and Auto Scaling group

Launch configurations are legacy and cannot be created in new accounts; use launch templates.

aws ec2 create-launch-template --launch-template-name app-server-template \
  --launch-template-data "{
    \"ImageId\": \"resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64\",
    \"InstanceType\": \"t3.medium\",
    \"SecurityGroup
Полный SKILL.md на GitHub

Установить aws-ec2 в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл aws-ec2?

Amazon EC2 provides resizable virtual servers on AWS. Use this skill to launch and manage EC2 instances with the AWS CLI: pick a current AMI, set up security groups, enforce IMDSv2, attach EBS volumes, build launch templates and Auto Scaling groups, and run Spot instances. Use when someone says "launch an EC2 instance", "resize my instance", "create an AMI", "set up an auto scaling group" or "use spot instances".

Как установить скилл aws-ec2?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл aws-ec2 запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить aws-ec2 с