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

aws-cdk-development

Skill này làm gì

Giúp bạn xây dựng và quản lý hạ tầng đám mây Amazon Web Services (AWS) bằng AWS CDK. Công cụ cung cấp hướng dẫn về các thực hành tốt nhất như đặt tên tài nguyên và thiết lập hàm Lambda, giúp hạ tầng của bạn an toàn và hiệu quả.

Khi nào nên dùng

  • ✓Khi bạn bắt đầu một dự án hạ tầng AWS mới với CDK.
  • ✓Khi bạn cần tái cấu trúc hoặc cải thiện hạ tầng hiện có.
  • ✓Khi bạn muốn đảm bảo thiết lập hạ tầng tuân theo các thực hành tốt nhất về bảo mật và hiệu quả.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/aws-cdk-development/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-cdk-development/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

“Làm thế nào để tạo một hàm Lambda bằng Python với AWS CDK, đồng thời các phụ thuộc được quản lý tự động?”

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

Cách hoạt động

Công cụ này dùng AWS CDK, cho phép bạn định nghĩa hạ tầng dưới dạng mã (TypeScript hoặc Python). Nó kiểm tra cấu hình bằng các công cụ xác thực và cung cấp ví dụ để triển khai các tài nguyên phổ biến như hàm Lambda, theo khuyến nghị của AWS.

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.

Bundled upstream support

Supporting files are included at skill-relative paths. See UPSTREAM-NOTICE.md for their pinned sources, licenses, hashes, and import changes.

Restored helper safety

scripts/validate-stack.sh runs cdk synth from the caller-selected project root, which executes that project's CDK application and dependencies, can write cdk.out, and may contact AWS context providers if the project requires lookups. Review the project and AWS context before invoking it. The helper does not deploy; deployment needs separate user authorization.

AWS CDK Development

This skill provides comprehensive guidance for developing AWS infrastructure using the Cloud Development Kit (CDK), with integrated MCP servers for accessing latest AWS knowledge and CDK utilities.

AWS Documentation Requirement

Always verify AWS facts using MCP tools (mcp__aws-mcp__* or mcp__*awsdocs*__*) before answering. The aws-mcp-setup dependency is auto-loaded — if MCP tools are unavailable, guide the user through that skill's setup flow.

CDK-Specific MCP Guidance

AWS Labs replaced the dedicated CDK MCP server (awslabs.cdk-mcp-server) with the broader awslabs.aws-iac-mcp-server, which covers CDK alongside CloudFormation and other AWS infrastructure-as-code workflows.

For CDK construct lookups, best-practice recommendations, and pattern guidance, install awslabs.aws-iac-mcp-server. It ships in the deploy-on-aws plugin from awslabs/agent-plugins, or can be registered directly with claude mcp add aws-iac uvx awslabs.aws-iac-mcp-server@latest.

When to reach for it:

  • CDK construct recommendations and API lookups
  • CDK and CloudFormation best-practice patterns
  • Validation of synthesized templates
  • Cross-resource configuration guidance

When to Use This Skill

Use this skill when:

  • Creating new CDK stacks or constructs
  • Refactoring existing CDK infrastructure
  • Implementing Lambda functions within CDK
  • Following AWS CDK best practices
  • Validating CDK stack configurations before deployment
  • Verifying AWS service capabilities and regional availability

Core CDK Principles

Resource Naming

CRITICAL: Do NOT explicitly specify resource names when they are optional in CDK constructs.

Why: CDK-generated names enable:

  • Reusable patterns: Deploy the same construct/pattern multiple times without conflicts
  • Parallel deployments: Multiple stacks can deploy simultaneously in the same region
  • Cleaner shared logic: Patterns and shared code can be initialized multiple times without name collision
  • Stack isolation: Each stack gets uniquely identified resources automatically

Pattern: Let CDK generate unique names automatically using CloudFormation's naming mechanism.

// ❌ BAD - Explicit naming prevents reusability and parallel deployments
new lambda.Function(this, 'MyFunction', {
  functionName: 'my-lambda',  // Avoid this
  // ...
});

// ✅ GOOD - Let CDK generate unique names
new lambda.Function(this, 'MyFunction', {
  // No functionName specified - CDK generates: StackName-MyFunctionXXXXXX
  // ...
});

Security Note: For different environments (dev, staging, prod), follow AWS Security Pillar best practices by using separate AWS accounts rather than relying on resource naming within a single account. Account-level isolation provides stronger security boundaries.

Lambda Function Development

Use the appropriate Lambda construct based on runtime:

TypeScript/JavaScript: Use @aws-cdk/aws-lambda-nodejs

import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';

new NodejsFunction(this, 'MyFunction', {
  entry: 'lambda/handler.ts',
  handler: 'handler',
  // Automatically handles bundling, dependencies, and transpilation
});

Python: Use @aws-cdk/aws-lambda-python

import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';

new PythonFunction(this, 'MyFunction', {
  entry: 'lambda',
  index: 'handler.py',
  handler: 'handler',
  // Automatically handles dependencies and packaging
});

Benefits:

  • Automatic bundling and dependency management
  • Transpilation handled automatically
  • No manual packaging required
  • Consistent deployment patterns

Pre-Deployment Validation

Use a multi-layer validation strategy for comprehensive CDK quality checks:

Layer 1: Real-Time IDE Feedback (Recommended)

For TypeScript/JavaScript projects:

…

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

Vì sao không nên ghi rõ tên tài nguyên trong CDK?

Không ghi tên cụ thể cho phép CDK tự tạo tên duy nhất. Điều này giúp mã dễ tái sử dụng hơn, hỗ trợ triển khai song song và tránh xung đột tên giữa các phần hạ tầng.

CDK xử lý việc tạo hàm Lambda như thế nào?

Với TypeScript/JavaScript, dùng `@aws-cdk/aws-lambda-nodejs`. Với Python, dùng `@aws-cdk/aws-lambda-python-alpha`. Các công cụ này tự động xử lý đóng gói, phụ thuộc và biên dịch, giúp đơn giản hóa quy trình.

Kiểm tra trước khi triển khai là gì và vì sao quan trọng?

Đó là quy trình kiểm tra nhiều lớp để đảm bảo chất lượng hạ tầng trước khi đưa lên AWS. Quy trình gồm phản hồi thời gian thực trong IDE, xác thực lúc tổng hợp (tạo template) và một lưới an toàn trước khi commit (build và kiểm thử).

Chi tiết

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

AWS Cloud Development Kit (CDK) expert for building cloud infrastructure with TypeScript/Python.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

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