Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)48k · #3858

aws-ec2

Skill này làm gì

Công cụ này giúp bạn tạo và quản lý các máy tính ảo trên đám mây của Amazon (AWS), gọi là EC2 instances. Bạn có thể thiết lập cách các máy này hoạt động, cần bao nhiêu máy và cách chúng giao tiếp với nhau.

Khi nào nên dùng

  • ✓Khi bạn cần một máy chủ để chạy website hoặc ứng dụng.
  • ✓Khi bạn muốn tạo bản sao chính xác của máy chủ để triển khai nhanh.
  • ✓Khi bạn muốn tự động điều chỉnh số lượng máy chủ theo nhu cầu.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/aws-ec2/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/aws-ec2/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tạo một máy chủ để chạy website thương mại điện tử, với 2 CPU và 8GB bộ nhớ, và đặt tự động mở rộng nếu mức sử dụng CPU vượt quá 70%.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Bạn dùng các lệnh cụ thể để nói với AWS cần tạo gì, như loại máy (instance), hệ điều hành (AMI) và quy tắc bảo mật. Sau đó AWS thiết lập mọi thứ cho bạn.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

AWS EC2

Deploy and manage Amazon EC2 compute instances for production, staging, and development workloads.

When to Use This Skill

  • Launching new compute instances for application hosting
  • Building golden AMIs for consistent deployments
  • Setting up auto-scaling groups behind load balancers
  • Migrating workloads to Spot instances for cost savings
  • Troubleshooting instance connectivity, performance, or launch failures
  • Creating launch templates for repeatable infrastructure

Prerequisites

  • AWS CLI v2 installed and configured (aws configure)
  • IAM permissions: ec2:*, autoscaling:*, elasticloadbalancing:*, iam:PassRole
  • An existing VPC with subnets (see aws-vpc (aws-vpc))
  • SSH key pair created (aws ec2 create-key-pair --key-name my-key --query 'KeyMaterial' --output text > my-key.pem)

Instance Type Selection Guide

Category Types Use Case
General Purpose t3, t3a, m6i, m7g Web servers, small databases, dev/test
Compute Optimized c6i, c7g Batch processing, media encoding, ML inference
Memory Optimized r6i, r7g, x2idn In-memory caches, large databases
Storage Optimized i3, i4i, d3 Data warehousing, distributed file systems
Accelerated p4d, g5, inf2 ML training, GPU rendering, inference
Burstable t3.micro-t3.2xlarge Low-steady-state with occasional bursts

Launch an Instance

# Launch a production web server
aws ec2 run-instances \
  --image-id ami-0abcdef1234567890 \
  --instance-type t3.medium \
  --key-name my-key \
  --security-group-ids sg-12345678 \
  --subnet-id subnet-12345678 \
  --iam-instance-profile Name=EC2AppProfile \
  --metadata-options "HttpTokens=required,HttpEndpoint=enabled" \
  --block-device-mappings '[{
    "DeviceName": "/dev/xvda",
    "Ebs": {
      "VolumeSize": 30,
      "VolumeType": "gp3",
      "Iops": 3000,
      "Throughput": 125,
      "Encrypted": true
    }
  }]' \
  --tag-specifications 'ResourceType=instance,Tags=[
    {Key=Name,Value=web-server-01},
    {Key=Environment,Value=production},
    {Key=Team,Value=platform}
  ]' \
  --user-data file://userdata.sh

# Launch with IMDSv2 required (security best practice)
aws ec2 run-instances \
  --image-id ami-0abcdef1234567890 \
  --instance-type t3.micro \
  --metadata-options "HttpTokens=required,HttpPutResponseHopLimit=1,HttpEndpoint=enabled" \
  --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=secure-instance}]'

User Data Scripts

#!/bin/bash
# userdata.sh - Bootstrap a web server on Amazon Linux 2023
set -euxo pipefail

# System updates
dnf update -y

# Install and start web server
dnf install -y nginx
systemctl enable nginx
systemctl start nginx

# Install CloudWatch agent
dnf install -y amazon-cloudwatch-agent
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \
  -a fetch-config -m ec2 \
  -s -c ssm:AmazonCloudWatch-linux

# Install CodeDeploy agent
dnf install -y ruby wget
cd /home/ec2-user
wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/latest/install
chmod +x ./install
./install auto

# Signal CloudFormation (if launched via CFN)
# /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource ASG --region ${AWS::Region}

Launch Templates

# Create a launch template with full configuration
aws ec2 create-launch-template \
  --launch-template-name web-server-template \
  --version-description "v1 - AL2023 with nginx" \
  --launch-template-data '{
    "ImageId": "ami-0abcdef1234567890",
    "InstanceType": "t3.medium",
    "KeyName": "my-key",
    "SecurityGroupIds": ["sg-12345678"],
    "IamInstanceProfile": {"Name": "EC2AppProfile"},
    "MetadataOptions": {
      "HttpTokens": "required",
      "HttpEndpoint": "enabled"
    },
    "BlockDeviceMappings": [{
      "DeviceName": "/dev/xvda",
      "Ebs": {
        "VolumeSize": 30,
        "VolumeType": "gp3",
        "Encrypted": true
      }
    }],
    "TagSpecifications": [{
      "ResourceType": "instance",
      "Tags": [
        {"Key": "Environment", "Value": "production"},
        {"Key": "ManagedBy", "Value": "launch-template"}
      ]
    }],
    "Monitoring": {"Enabled": true},
    "UserData": "'"$(base64 -w0 userdata.sh)"'"
  }'

# Create a new version of the launch template
aws ec2 create-launch-template-version \
  --launch-template-name web-server-template \
  --source-version 1 \
  --version-description "v2 - updated AMI" \

…
Câu hỏi thường gặp

EC2 instance là gì?

Đó là một máy chủ ảo trong đám mây Amazon Web Services (AWS), dùng để chạy ứng dụng của bạn.

AMI là gì?

Đó là mẫu hoặc ảnh của một hệ điều hành và phần mềm đã cài sẵn, dùng để tạo các EC2 instance mới.

Auto-scaling group là gì?

Đó là hệ thống tự động thêm hoặc bớt máy chủ (EC2 instance) theo nhu cầu, để ứng dụng chạy mượt mà và không bị gián đoạn.

Chi tiết

Mô tả gốc của tác giả

Manage EC2 instances, AMIs, and auto-scaling groups. Configure security groups, key pairs, and instance types. Use when deploying compute resources on AWS.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#3858
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự