aws-ec2
Amazon EC2インスタンスを起動・管理し、AMIやセキュリティグループなどを設定、可用性とコスト効率を高めるオートスケーリンググループを構築することで、柔軟なコンピューティング環境を構築・運用するSkill。
📜 元の英語説明(参考)
Launch and manage Amazon EC2 instances for scalable compute. Configure AMIs, security groups, key pairs, and EBS volumes. Set up auto-scaling groups for high availability and cost optimization across availability zones.
🇯🇵 日本人クリエイター向け解説
Amazon EC2インスタンスを起動・管理し、AMIやセキュリティグループなどを設定、可用性とコスト効率を高めるオートスケーリンググループを構築することで、柔軟なコンピューティング環境を構築・運用するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o aws-ec2.zip https://jpskill.com/download/14666.zip && unzip -o aws-ec2.zip && rm aws-ec2.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14666.zip -OutFile "$d\aws-ec2.zip"; Expand-Archive "$d\aws-ec2.zip" -DestinationPath $d -Force; ri "$d\aws-ec2.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
aws-ec2.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
aws-ec2フォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
AWS EC2
Amazon Elastic Compute Cloud (EC2) は、クラウド上でサイズ変更可能な仮想サーバーを提供します。これは、単純なウェブサーバーから複雑な分散システムまで、アプリケーションを実行するための基盤となるコンピューティングサービスです。
コアコンセプト
- Instance — CPU、メモリ、ストレージ、およびネットワークを備えた仮想サーバー
- AMI — Amazon Machine Image。インスタンスを起動するためのテンプレート
- Instance type — ハードウェア構成 (t3.micro, m5.xlarge, など)
- Security group — インバウンド/アウトバウンドトラフィックを制御する仮想ファイアウォール
- Key pair — Linux インスタンス用の SSH 認証
- EBS — Elastic Block Store。永続的なブロックストレージボリューム
インスタンスの起動
# Launch a basic EC2 instance
aws ec2 run-instances \
--image-id ami-0c55b159cbfafe1f0 \
--instance-type t3.micro \
--key-name my-key-pair \
--security-group-ids sg-0123456789abcdef0 \
--subnet-id subnet-0123456789abcdef0 \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=web-server-1}]' \
--count 1
# Launch with user data script for bootstrapping
aws ec2 run-instances \
--image-id ami-0c55b159cbfafe1f0 \
--instance-type t3.small \
--key-name my-key-pair \
--security-group-ids sg-0123456789abcdef0 \
--user-data file://setup.sh \
--iam-instance-profile Name=ec2-app-role \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=app-server},{Key=Env,Value=prod}]'
# setup.sh — bootstrap script for EC2 instance
#!/bin/bash
yum update -y
yum install -y docker
systemctl start docker
systemctl enable docker
docker pull myapp:latest
docker run -d -p 80:8080 myapp:latest
インスタンスの管理
# List running instances with key details
aws ec2 describe-instances \
--filters "Name=instance-state-name,Values=running" \
--query 'Reservations[].Instances[].[InstanceId,InstanceType,PublicIpAddress,Tags[?Key==`Name`].Value|[0]]' \
--output table
# Stop, start, terminate instances
aws ec2 stop-instances --instance-ids i-0123456789abcdef0
aws ec2 start-instances --instance-ids i-0123456789abcdef0
aws ec2 terminate-instances --instance-ids i-0123456789abcdef0
# Resize an instance (must be stopped first)
aws ec2 stop-instances --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
セキュリティグループ
# Create a security group for a web server
aws ec2 create-security-group \
--group-name web-sg \
--description "Allow HTTP, HTTPS, SSH" \
--vpc-id vpc-0123456789abcdef0
# Add inbound rules
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}]'
AMI
# Create an AMI from a running instance
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
# List your AMIs
aws ec2 describe-images --owners self \
--query 'Images[*].[ImageId,Name,CreationDate]' --output table
# Deregister old AMI and delete snapshot
aws ec2 deregister-image --image-id ami-0123456789abcdef0
aws ec2 delete-snapshot --snapshot-id snap-0123456789abcdef0
EBS ボリューム
# Create and attach an EBS volume
aws ec2 create-volume \
--size 100 \
--volume-type gp3 \
--availability-zone us-east-1a \
--iops 3000 \
--throughput 125 \
--tag-specifications 'ResourceType=volume,Tags=[{Key=Name,Value=data-vol}]'
# Attach volume to instance
aws ec2 attach-volume \
--volume-id vol-0123456789abcdef0 \
--instance-id i-0123456789abcdef0 \
--device /dev/xvdf
# Create a snapshot for backup
aws ec2 create-snapshot \
--volume-id vol-0123456789abcdef0 \
--description "Daily backup $(date +%Y-%m-%d)" \
--tag-specifications 'ResourceType=snapshot,Tags=[{Key=Name,Value=daily-backup}]'
Auto Scaling
# Create a launch template
aws ec2 create-launch-template \
--launch-template-name app-server-template \
--launch-template-data '{
"ImageId": "ami-0c55b159cbfafe1f0",
"InstanceType": "t3.medium",
"SecurityGroupIds": ["sg-0123456789abcdef0"],
"KeyName": "my-key-pair",
"IamInstanceProfile": {"Name": "ec2-app-role"},
"UserData": "'$(base64 -w0 setup.sh)'"
}'
# Create an auto-scaling group
aws autoscaling create-auto-scaling-group \
--auto-scaling-group-name app-asg \
--launch-template LaunchTemplateName=app-server-template,Version='$Latest' \
--min-size 2 \
--max-size 10 \
--desired-capacity 2 \
--vpc-zone-identifier "subnet-aaa,subnet-bbb" \
--target-group-arns "arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/app-tg/abc123" \
--health-check-type ELB \
--health-check-grace-period 300
# Create scaling policy based on CPU
aws autoscaling put-scaling-policy \
--auto-scaling-group-name app-asg \
--policy-name cpu-scale-out \
--policy-type TargetTrackingScaling \
--target-tracking-configuration '{
"PredefinedMetricSpecification": {"PredefinedMetricType": "ASGAverageCPUUtilization"},
"TargetValue": 70.0,
"ScaleInCooldown": 300,
"ScaleOutCooldown": 60
}'
Spot Instances
# Request spot instances for cost savings (up to 90% off)
aws ec2 request-spot-instances \
--instance-count 3 \
--type "one-time" \
--launch-specification '{
"ImageId": "ami-0c55b159cbfafe1f0",
"InstanceType": "c5.xlarge",
"SecurityGroupIds": ["sg-0123456789abcdef0"],
"SubnetId": "subnet-0123456789abcdef0"
}'
ベストプラクティス
- 起動設定よりも起動テンプレートを使用してください
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
AWS EC2
Amazon Elastic Compute Cloud (EC2) provides resizable virtual servers in the cloud. It's the foundational compute service for running applications, from simple web servers to complex distributed systems.
Core Concepts
- Instance — a virtual server with CPU, memory, storage, and networking
- AMI — Amazon Machine Image, a template for launching instances
- Instance type — hardware configuration (t3.micro, m5.xlarge, etc.)
- Security group — virtual firewall controlling inbound/outbound traffic
- Key pair — SSH authentication for Linux instances
- EBS — Elastic Block Store, persistent block storage volumes
Launching Instances
# Launch a basic EC2 instance
aws ec2 run-instances \
--image-id ami-0c55b159cbfafe1f0 \
--instance-type t3.micro \
--key-name my-key-pair \
--security-group-ids sg-0123456789abcdef0 \
--subnet-id subnet-0123456789abcdef0 \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=web-server-1}]' \
--count 1
# Launch with user data script for bootstrapping
aws ec2 run-instances \
--image-id ami-0c55b159cbfafe1f0 \
--instance-type t3.small \
--key-name my-key-pair \
--security-group-ids sg-0123456789abcdef0 \
--user-data file://setup.sh \
--iam-instance-profile Name=ec2-app-role \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=app-server},{Key=Env,Value=prod}]'
# setup.sh — bootstrap script for EC2 instance
#!/bin/bash
yum update -y
yum install -y docker
systemctl start docker
systemctl enable docker
docker pull myapp:latest
docker run -d -p 80:8080 myapp:latest
Instance Management
# List running instances with key details
aws ec2 describe-instances \
--filters "Name=instance-state-name,Values=running" \
--query 'Reservations[].Instances[].[InstanceId,InstanceType,PublicIpAddress,Tags[?Key==`Name`].Value|[0]]' \
--output table
# Stop, start, terminate instances
aws ec2 stop-instances --instance-ids i-0123456789abcdef0
aws ec2 start-instances --instance-ids i-0123456789abcdef0
aws ec2 terminate-instances --instance-ids i-0123456789abcdef0
# Resize an instance (must be stopped first)
aws ec2 stop-instances --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
Security Groups
# Create a security group for a web server
aws ec2 create-security-group \
--group-name web-sg \
--description "Allow HTTP, HTTPS, SSH" \
--vpc-id vpc-0123456789abcdef0
# Add inbound rules
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}]'
AMIs
# Create an AMI from a running instance
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
# List your AMIs
aws ec2 describe-images --owners self \
--query 'Images[*].[ImageId,Name,CreationDate]' --output table
# Deregister old AMI and delete snapshot
aws ec2 deregister-image --image-id ami-0123456789abcdef0
aws ec2 delete-snapshot --snapshot-id snap-0123456789abcdef0
EBS Volumes
# Create and attach an EBS volume
aws ec2 create-volume \
--size 100 \
--volume-type gp3 \
--availability-zone us-east-1a \
--iops 3000 \
--throughput 125 \
--tag-specifications 'ResourceType=volume,Tags=[{Key=Name,Value=data-vol}]'
# Attach volume to instance
aws ec2 attach-volume \
--volume-id vol-0123456789abcdef0 \
--instance-id i-0123456789abcdef0 \
--device /dev/xvdf
# Create a snapshot for backup
aws ec2 create-snapshot \
--volume-id vol-0123456789abcdef0 \
--description "Daily backup $(date +%Y-%m-%d)" \
--tag-specifications 'ResourceType=snapshot,Tags=[{Key=Name,Value=daily-backup}]'
Auto Scaling
# Create a launch template
aws ec2 create-launch-template \
--launch-template-name app-server-template \
--launch-template-data '{
"ImageId": "ami-0c55b159cbfafe1f0",
"InstanceType": "t3.medium",
"SecurityGroupIds": ["sg-0123456789abcdef0"],
"KeyName": "my-key-pair",
"IamInstanceProfile": {"Name": "ec2-app-role"},
"UserData": "'$(base64 -w0 setup.sh)'"
}'
# Create an auto-scaling group
aws autoscaling create-auto-scaling-group \
--auto-scaling-group-name app-asg \
--launch-template LaunchTemplateName=app-server-template,Version='$Latest' \
--min-size 2 \
--max-size 10 \
--desired-capacity 2 \
--vpc-zone-identifier "subnet-aaa,subnet-bbb" \
--target-group-arns "arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/app-tg/abc123" \
--health-check-type ELB \
--health-check-grace-period 300
# Create scaling policy based on CPU
aws autoscaling put-scaling-policy \
--auto-scaling-group-name app-asg \
--policy-name cpu-scale-out \
--policy-type TargetTrackingScaling \
--target-tracking-configuration '{
"PredefinedMetricSpecification": {"PredefinedMetricType": "ASGAverageCPUUtilization"},
"TargetValue": 70.0,
"ScaleInCooldown": 300,
"ScaleOutCooldown": 60
}'
Spot Instances
# Request spot instances for cost savings (up to 90% off)
aws ec2 request-spot-instances \
--instance-count 3 \
--type "one-time" \
--launch-specification '{
"ImageId": "ami-0c55b159cbfafe1f0",
"InstanceType": "c5.xlarge",
"SecurityGroupIds": ["sg-0123456789abcdef0"],
"SubnetId": "subnet-0123456789abcdef0"
}'
Best Practices
- Use launch templates over launch configurations for versioning
- Place instances in private subnets; use a bastion host or SSM for access
- Enable detailed monitoring for production workloads
- Use auto-scaling with target tracking for hands-off scaling
- Tag everything for cost allocation and resource management
- Use spot instances for fault-tolerant, flexible workloads
- Rotate AMIs regularly with latest security patches