mcpField
A
aws-serverless-deployment

aws-serverless-deployment

github.com/awslabsCloud & DevOps932152 installsUpdated 3w ago
Repository

About aws-serverless-deployment

AWS Serverless Deployment is a skill for building and deploying serverless applications on AWS with SAM or CDK. It covers project setup, infrastructure definitions, deployment workflows and CI/CD, with CDK and TypeScript as defaults.

Key features

  1. 01SAM and CDK project setup
  2. 02Infrastructure templates and constructs
  3. 03Deployment workflows and CI/CD pipelines
  4. 04Guidance for SAM/CDK coexistence
  5. 05Automatic SAM template validation hook

Use cases

  1. 01Scaffold a new AWS serverless project
  2. 02Create or review SAM templates and CDK constructs
  3. 03Set up a deployment workflow or CI/CD pipeline
  4. 04Plan a SAM-to-CDK migration

MCP support

The skill uses the AWS Serverless MCP Server to create projects, generate infrastructure code and deploy. Write access is enabled by default; sensitive data access requires an additional setting.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/awslabs/agent-plugins --skill aws-serverless-deployment

After installing, type/aws-serverless-deploymentin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
cdk-lambda-constructs.md
cdk-project-setup.md
cdk-serverless-patterns.md
sam-cdk-coexistence.md
sam-project-setup.md

Details

From the project README

AWS Serverless Deployment

Deploy serverless applications to AWS using SAM or CDK. This skill covers project scaffolding, IaC templates, CDK constructs and patterns, deployment workflows, CI/CD pipelines, and SAM/CDK coexistence.

For Lambda runtime behavior, event sources, orchestration, observability, and optimization, see the aws-lambda skill.

When to Load Reference Files

Load the appropriate reference file based on what the user is working on:

Best Practices

SAM
  • Do: Use sam_init with an appropriate template for your use case
  • Do: Set global defaults for timeout, memory, runtime, and tracing in the Globals section
  • Do: Use samconfig.toml environment-specific sections for multi-environment deployments
  • Do: Use sam build --use-container when native dependencies are involved
  • Don't: Copy-paste templates from the internet without understanding the resource configuration
  • Don't: Hardcode resource ARNs or account IDs in templates — use !Ref, !GetAtt, and !Sub
CDK
  • Do: Use TypeScript — type checking catches errors at synthesis time, before any AWS API calls
  • Do: Prefer L2 constructs and grant* methods over L1 and raw IAM statements
  • Do: Separate stateful and stateless resources into different stacks; enable termination protection on stateful stacks
  • Do: Commit cdk.context.json to version control — it caches VPC/AZ lookups for deterministic synthesis
  • Do: Write unit tests with aws-cdk-lib/assertions; assert logical IDs of stateful resources to detect accidental replacements
  • Do: Use cdk diff in CI before every deployment to review changes
  • Don't: Hardcode account IDs or region strings — use this.account and this.region
  • Don't: Use cdk deploy directly in production without a pipeline
  • Don't: Skip cdk bootstrap — deployments will fail without the CDK toolkit stack

Configuration

AWS CLI Setup

This skill requires that AWS credentials are configured on the host machine:

Verify access: Run aws sts get-caller-identity to confirm credentials are valid

SAM CLI Setup

Verify: Run sam --version

Container Runtime Setup
  1. Install a Docker compatible container runtime: Required for sam_local_invoke and container-based builds
  2. Verify: Use an appropriate command such as docker --version or finch --version
AWS Serverless MCP Server

Write access is enabled by default. The plugin ships with --allow-write in .mcp.json, so the MCP server can create projects, generate IaC, and deploy on behalf of the user.

Access to sensitive data (like Lambda and API Gateway logs) is not enabled by default. To grant it, add --allow-sensitive-data-access to .mcp.json.

SAM Template Validation Hook

This plugin includes a PostToolUse hook that runs sam validate automatically after any edit to template.yaml or template.yml. If validation fails, the error is returned as a system message so you can fix it immediately. The hook requires SAM CLI and jq to be installed; if either is missing, validation is skipped with a system message. Users can disable it via /hooks.

Verify: Run jq --version

IaC framework selection

Default: CDK

Override syntax:

  • "use CloudFormation" → Generate YAML templates
  • "use SAM" → Generate YAML templates

When not specified, ALWAYS use CDK

Language selection for CDK

Default: TypeScript

Override syntax:

  • "use Python" → Generate Python code
  • "use JavaScript" → Generate JavaScript code

When not specified, ALWAYS use TypeScript

Error Scenarios

Serverless MCP Server Unavailable
  • Inform user: "AWS Serverless MCP not responding"
  • Ask: "Proceed without MCP support?"
  • DO NOT continue without user confirmation

Resources

Comments

Markdown supported