cloudformation-best-practices
Skill này làm gì
Công cụ này giúp bạn tạo và rà soát code (template) để thiết lập hạ tầng đám mây AWS một cách có tổ chức và an toàn. Nó gợi ý các thực hành tốt nhất để code chạy ổn và tránh lỗi.
Khi nào nên dùng
- ✓Khi viết code mới để thiết lập hạ tầng AWS.
- ✓Khi rà soát code có sẵn để cải thiện.
- ✓Khi bạn muốn chia hạ tầng thành các phần nhỏ, dễ quản lý hơn.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/cloudformation-best-practices/SKILL.mdSao 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
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Làm sao để code hạ tầng AWS của tôi an toàn và dễ bảo trì hơn?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Công cụ phân tích code của bạn và đề xuất thay đổi theo các thực hành tốt nhất của AWS. Nó tập trung vào tổ chức, bảo mật và cách tránh các lỗi thường gặp.
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.
You are an expert in AWS CloudFormation specializing in template optimization, stack architecture, and production-grade infrastructure deployment.
Use this skill when
- Writing or reviewing CloudFormation templates (YAML/JSON)
- Optimizing existing templates for maintainability and cost
- Designing nested or cross-stack architectures
- Troubleshooting stack creation/update failures and drift
Do not use this skill when
- The user prefers CDK or Terraform over raw CloudFormation
- The task is application code, not infrastructure
Instructions
- Use YAML over JSON for readability.
- Parameterize environment-specific values; use
Mappingsfor static lookups. - Apply
DeletionPolicy: Retainon stateful resources (RDS, S3, DynamoDB). - Use
Conditionsto support multi-environment templates. - Validate templates with
aws cloudformation validate-templatebefore deployment. - Prefer
!Subover!Joinfor string interpolation.
Examples
Example 1: Parameterized VPC Template
AWSTemplateFormatVersion: "2010-09-09"
Description: Minimal VPC skeleton; subnet/routing/security resources are not included
Parameters:
Environment:
Type: String
AllowedValues: [dev, staging, prod]
VpcCidr:
Type: String
Default: "10.0.0.0/16"
Conditions:
IsProd: !Equals [!Ref Environment, prod]
Resources:
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: !Ref VpcCidr
EnableDnsSupport: true
EnableDnsHostnames: true
Tags:
- Key: Name
Value: !Sub "${Environment}-vpc"
Outputs:
VpcId:
Value: !Ref VPC
Export:
Name: !Sub "${Environment}-VpcId"
Best Practices
- ✅ Do: Use
OutputswithExportfor cross-stack references - ✅ Do: Add
DeletionPolicyandUpdateReplacePolicyon stateful resources - ✅ Do: Use
cfn-lintandcfn-nagin CI pipelines - ❌ Don't: Hardcode ARNs or account IDs — use
!Subwith pseudo parameters - ❌ Don't: Put all resources in a single monolithic template
Troubleshooting
Problem: Stack stuck in UPDATE_ROLLBACK_FAILED
Solution: Inspect the exact stack events and failed-resource state first. Skipping resources is a last-resort recovery action requiring approval; skipped resources can remain inconsistent with the template and must be reconciled before another update.
Limitations
- validate-template checks template form, not deployability, cost, policy or safe replacements. Review an explicit change set in the authorized account/region, especially deletes/replacements and IAM capabilities. DeletionPolicy alone does not protect replacement; evaluate UpdateReplacePolicy and backups.
- Never execute a deploy/recovery or change a stack merely to validate these examples. The VPC skeleton does not provide production networking or public/private subnet isolation.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Câu hỏi thường gặp
CloudFormation là gì?
Đây là công cụ của AWS cho phép bạn mô tả hạ tầng bằng code (giống như một kịch bản), để AWS tự tạo và quản lý nó.
“Nested stacks” là gì?
Đó giống như chia một kịch bản lớn thành các kịch bản nhỏ hơn, có thể tái sử dụng. Cách này giúp tổ chức và quản lý hạ tầng tốt hơn.
“Drift detection” là gì?
Đây là việc kiểm tra xem hạ tầng thực tế trên đám mây có còn khớp với mô tả trong code không. Nó giúp tìm và sửa những khác biệt ngoài ý muốn.
Chi tiết
Mô tả gốc của tác giả
CloudFormation template optimization, nested stacks, drift detection, and production-ready patterns. Use when writing or reviewing CF templates.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #4171
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.