Langsung ke konten
Skillpedia
Deploy & cloud (DevOps)48k · #4171

cloudformation-best-practices

Fungsinya

Tool ini membantu Anda membuat dan meninjau kode (template) untuk menyiapkan infrastruktur cloud AWS secara terorganisir dan aman. Tool ini memberikan saran praktik terbaik agar kode Anda berjalan dengan baik dan terhindar dari masalah.

Kapan dipakai

  • ✓Saat menulis kode baru untuk menyiapkan infrastruktur cloud AWS.
  • ✓Saat meninjau kode yang sudah ada untuk meningkatkannya.
  • ✓Saat Anda ingin memecah infrastruktur menjadi bagian-bagian kecil yang lebih mudah dikelola.

Link skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/cloudformation-best-practices/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/cloudformation-best-practices/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Bagaimana cara membuat kode infrastruktur AWS saya lebih aman dan mudah dirawat?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Tool ini menganalisis kode Anda dan menyarankan perubahan sesuai praktik terbaik AWS. Fokusnya pada organisasi, keamanan, dan cara menghindari kesalahan umum.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

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

  1. Use YAML over JSON for readability.
  2. Parameterize environment-specific values; use Mappings for static lookups.
  3. Apply DeletionPolicy: Retain on stateful resources (RDS, S3, DynamoDB).
  4. Use Conditions to support multi-environment templates.
  5. Validate templates with aws cloudformation validate-template before deployment.
  6. Prefer !Sub over !Join for 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 Outputs with Export for cross-stack references
  • ✅ Do: Add DeletionPolicy and UpdateReplacePolicy on stateful resources
  • ✅ Do: Use cfn-lint and cfn-nag in CI pipelines
  • ❌ Don't: Hardcode ARNs or account IDs — use !Sub with 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.
Pertanyaan umum

Apa itu CloudFormation?

CloudFormation adalah tool AWS yang memungkinkan Anda mendeskripsikan infrastruktur dalam bentuk kode (seperti skrip), sehingga AWS bisa membuat dan mengelolanya secara otomatis.

Apa itu 'nested stacks'?

Ini seperti memecah skrip besar menjadi skrip-skrip kecil yang bisa dipakai ulang. Cara ini membantu mengatur dan mengelola infrastruktur dengan lebih baik.

Apa itu 'drift detection'?

Ini adalah pengecekan apakah infrastruktur yang benar-benar berjalan di cloud masih sesuai dengan yang dideskripsikan di kode Anda. Fitur ini membantu menemukan dan memperbaiki perbedaan yang tidak diharapkan.

Detail

Deskripsi asli dari pembuat

CloudFormation template optimization, nested stacks, drift detection, and production-ready patterns. Use when writing or reviewing CF templates.

repo: sickn33/agentic-awesome-skills

Popularitas

Bintang GitHub
48k
Peringkat
#4171
Lisensi
MIT
Diperbarui
15/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa