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

cloudformation

Skill này làm gì

Công cụ này giúp bạn tạo và quản lý hạ tầng trên đám mây của Amazon (AWS) bằng code gọi là CloudFormation. Bạn mô tả các tài nguyên cần thiết, như máy chủ và cơ sở dữ liệu, trong một file văn bản, và AWS sẽ tự tạo chúng cho bạn.

Khi nào nên dùng

  • ✓Khi bạn muốn tạo cùng một thiết lập hạ tầng nhiều lần.
  • ✓Khi bạn thay đổi hạ tầng hiện có một cách an toàn.
  • ✓Khi bạn muốn tổ chức và quản lý các phần phức tạp của hạ tầng.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/cloudformation/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/cloudformation/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 hạ tầng cho một website đơn giản gồm máy chủ web và cơ sở dữ liệu.”

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

Cách hoạt động

Bạn viết một file văn bản mô tả các tài nguyên AWS cần dùng. Công cụ đọc file này và hướng dẫn AWS tạo hoặc thay đổi các tài nguyên đó. Nó cũng có thể kiểm tra xem hạ tầng thực tế có khớp với file không.

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.

CloudFormation

Deploy AWS infrastructure with native CloudFormation templates, change sets, nested stacks, and drift detection.

When to Use This Skill

  • Deploying AWS resources using AWS-native Infrastructure as Code
  • Creating repeatable, parameterized infrastructure templates
  • Managing multi-environment deployments (dev, staging, prod) with the same template
  • Implementing safe deployments with change sets and rollback protection
  • Detecting and remediating configuration drift
  • Organizing large infrastructure into nested stacks
  • Exporting/importing values between stacks

Prerequisites

  • AWS CLI v2 installed and configured
  • IAM permissions: cloudformation:*, plus permissions for all resources in the template
  • (Optional) cfn-lint installed for template validation (pip install cfn-lint)
  • S3 bucket for storing templates larger than 51,200 bytes

Template Structure

AWSTemplateFormatVersion: '2010-09-09'
Description: Production web application infrastructure

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
      - Label: { default: "Environment" }
        Parameters: [Environment, InstanceType]
      - Label: { default: "Network" }
        Parameters: [VpcId, SubnetIds]

Parameters:
  Environment:
    Type: String
    AllowedValues: [dev, staging, prod]
    Default: dev

  InstanceType:
    Type: String
    Default: t3.micro
    AllowedValues: [t3.micro, t3.small, t3.medium, t3.large]

  VpcId:
    Type: AWS::EC2::VPC::Id
    Description: VPC to deploy into

  SubnetIds:
    Type: List<AWS::EC2::Subnet::Id>
    Description: Subnets for the application

Conditions:
  IsProd: !Equals [!Ref Environment, prod]
  CreateReadReplica: !Equals [!Ref Environment, prod]

Mappings:
  RegionAMI:
    us-east-1:
      AL2023: ami-0abcdef1234567890
    us-west-2:
      AL2023: ami-0fedcba9876543210

Resources:
  SecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: !Sub '${Environment}-web-sg'
      VpcId: !Ref VpcId
      SecurityGroupIngress:
        - IpProtocol: tcp
          FromPort: 443
          ToPort: 443
          CidrIp: 0.0.0.0/0
      Tags:
        - Key: Name
          Value: !Sub '${Environment}-web-sg'

  LaunchTemplate:
    Type: AWS::EC2::LaunchTemplate
    Properties:
      LaunchTemplateName: !Sub '${Environment}-web'
      LaunchTemplateData:
        ImageId: !FindInMap [RegionAMI, !Ref 'AWS::Region', AL2023]
        InstanceType: !If [IsProd, t3.large, !Ref InstanceType]
        MetadataOptions:
          HttpTokens: required
        SecurityGroupIds:
          - !Ref SecurityGroup

  AutoScalingGroup:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      AutoScalingGroupName: !Sub '${Environment}-web-asg'
      LaunchTemplate:
        LaunchTemplateId: !Ref LaunchTemplate
        Version: !GetAtt LaunchTemplate.LatestVersionNumber
      MinSize: !If [IsProd, 2, 1]
      MaxSize: !If [IsProd, 10, 3]
      DesiredCapacity: !If [IsProd, 4, 1]
      VPCZoneIdentifier: !Ref SubnetIds
      TargetGroupARNs:
        - !Ref TargetGroup
      HealthCheckType: ELB
      HealthCheckGracePeriod: 300
      Tags:
        - Key: Name
          Value: !Sub '${Environment}-web'
          PropagateAtLaunch: true
    UpdatePolicy:
      AutoScalingRollingUpdate:
        MinInstancesInService: !If [IsProd, 2, 0]
        MaxBatchSize: 1
        PauseTime: PT5M
        WaitOnResourceSignals: true
        SuspendProcesses:
          - HealthCheck
          - ReplaceUnhealthy
          - AZRebalance
          - AlarmNotification
          - ScheduledActions

  TargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Name: !Sub '${Environment}-web-tg'
      Port: 8080
      Protocol: HTTP
      VpcId: !Ref VpcId
      TargetType: instance
      HealthCheckPath: /health
      HealthCheckIntervalSeconds: 30
      HealthyThresholdCount: 2
      UnhealthyThresholdCount: 3

Outputs:
  SecurityGroupId:
    Description: Web security group ID
    Value: !Ref SecurityGroup
    Export:
      Name: !Sub '${Environment}-WebSecurityGroup'

  AutoScalingGroupName:
    Description: ASG name
    Value: !Ref AutoScalingGroup
    Export:
      Name: !Sub '${Environment}-WebASG'

Stack Operations

# Validate a template
aws cloudformation validate-template --template-body file://template.yaml

# Lint with cfn-lint (catches more issues)
cfn-lint template.yaml

# Create a stack
aws cloudformation create-stack \

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

“Infrastructure as Code” là gì?

Đây là cách quản lý và cấp phát hạ tầng IT thông qua các file định nghĩa mà máy có thể đọc, thay vì cấu hình thủ công hoặc qua công cụ tương tác. CloudFormation là một ví dụ trong AWS.

“Stack” là gì?

“Stack” là tập hợp các tài nguyên AWS được quản lý như một đơn vị. Ví dụ, bạn có thể có một stack cho ứng dụng web, gồm máy chủ, cơ sở dữ liệu và mạng.

“Drift detection” là gì?

Đây là tính năng so sánh cấu hình thực tế của tài nguyên AWS với cấu hình trong file CloudFormation. Nó giúp phát hiện ai đó đã sửa thủ công hạ tầng, điều có thể gây ra vấn đề.

Chi tiết

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

Deploy AWS resources with CloudFormation templates. Create stacks, use nested stacks, and implement drift detection. Use when deploying AWS-native IaC.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#4172
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ự