Generated banner for AWS Serverless Deployment
Generated logo for AWS Serverless Deployment

AWS Serverless Deployment

AWS LabsOfficialPublished by AWS Labs

  • Skill
  • Tool integration
  • Cloud and DevOps
  • Apache-2.0
  • Low risk

From the author

AWS SAM and AWS CDK deployment for serverless applications. Triggers on phrases like: use SAM, SAM template, SAM init, SAM deploy, CDK serverless, CDK Lambda construct, NodejsFunction, PythonFunction, SAM and CDK together, serverless CI/CD pipeline. For general app deployment with service selection, use deploy-on-aws plugin instead.
— the description by AWS Labs

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured approach to deploying serverless applications on AWS. It supports both AWS SAM and AWS CDK, offering guidance on project scaffolding, IaC template management, Lambda function constructs, and CI/CD pipeline integration. It includes best practices for resource configuration, environment management, and testing, while providing specific hooks for SAM template validation and automated deployment workflows.

What it does

  • Provides project scaffolding for both SAM and CDK serverless applications.
  • Offers guidance on using L2 CDK constructs for optimized Lambda function deployment.
  • Automates SAM template validation via a post-edit hook.
  • Supports multi-environment deployment strategies using configuration files.
  • Facilitates the integration of CI/CD pipelines for serverless infrastructure.
  • Provides reference material for SAM and CDK coexistence and migration.

When to use it

  • When initializing a new serverless project on AWS.
  • When you need to define Lambda functions using optimized CDK constructs like NodejsFunction.
  • When you require automated validation for your SAM templates.
  • When setting up infrastructure-as-code for serverless resources like DynamoDB, SQS, or API Gateway.
  • When migrating or managing a project that uses both SAM and CDK.

Advantages

  • Promotes the use of L2 constructs for safer, least-privilege IAM policies.
  • Enables type-safe infrastructure development using TypeScript with CDK.
  • Reduces manual errors through automated template validation.
  • Simplifies complex resource wiring with pre-defined serverless patterns.
  • Supports deterministic synthesis through cached context files.

Usage examples

“Initialize a new serverless project using CDK with TypeScript.”
The agent will guide you through the cdk init process, setting up the project structure with bin, lib, and test directories.
“How do I define a Lambda function in CDK using NodejsFunction?”
The agent will provide a code snippet demonstrating the NodejsFunction construct, including configuration for runtime, memory, and esbuild bundling.
“Validate my current SAM template.”
The agent will trigger the sam validate command to check your template.yaml for syntax and configuration errors.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/awslabs/aws-serverless-deployment/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip aws-serverless-deployment.zip -d .agents/skills

Documentation by AWS Labs

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

Files

Requirements and compatibility

Written for: Claude Code

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Claude Code frontmatter, Needs an MCP server

Security

What our scanner noticed· Low risk

  • Instructions that use the network

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
AWS Labs
Publisher
AWS Labs (Official)
Source
awslabs/agent-plugins · plugins/aws-serverless/skills/aws-serverless-deployment · commit fbefb37
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • NOTICE (added by AutoGineer from NOTICE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by AWS Labs.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download aws-serverless-deployment.zip