plugins/developer-kit-aws/skills/aws-cloudformation/aws-cloudformation-lambda/SKILL.md
Provides AWS CloudFormation patterns for Lambda functions, layers, API Gateway integration, event sources, cold start optimization, monitoring, logging, template validation, and deployment workflows. Use when creating Lambda functions with CloudFormation, configuring event sources, implementing cold start optimization, managing layers, integrating with API Gateway, and deploying Lambda infrastructure.
npx skillsauth add giuseppe-trisciuoglio/developer-kit aws-cloudformation-lambdaInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create production-ready Lambda functions using CloudFormation templates with validation and deployment workflows.
Always follow this deployment workflow:
aws cloudformation validate-template --template-body file://template.yaml
aws cloudformation deploy \
--template-file template.yaml \
--stack-name my-lambda-stack \
--capabilities CAPABILITY_IAM \
--parameter-overrides Environment=prod
aws cloudformation describe-stack-events \
--stack-name my-lambda-stack \
--query 'StackEvents[?ResourceStatus==`CREATE_FAILED`||ResourceStatus==`UPDATE_FAILED`]'
aws lambda get-function --function-name my-lambda-stack-function
aws cloudformation describe-stacks --stack-name my-lambda-stack \
--query 'Stacks[0].StackStatus'
aws cloudformation delete-stack --stack-name my-lambda-stack
aws logs describe-log-groups --log-group-name-prefix "/aws/lambda/my-lambda"
Follow these steps to create Lambda functions with CloudFormation:
Specify runtime, memory, timeout, and environment variables:
Parameters:
FunctionMemory:
Type: Number
Default: 256
AllowedValues:
- 128
- 256
- 512
- 1024
- 2048
Description: Lambda function memory in MB
FunctionTimeout:
Type: Number
Default: 30
MinValue: 1
MaxValue: 900
Description: Function timeout in seconds
Runtime:
Type: String
Default: nodejs20.x
AllowedValues:
- nodejs20.x
- python3.11
- java21
- dotnet8
- go1.x
Description: Lambda runtime environment
Define the basic function configuration:
Resources:
LambdaFunction:
Type: AWS::Lambda::Function
Properties:
FunctionName: !Sub "${AWS::StackName}-function"
Runtime: !Ref Runtime
Handler: index.handler
Role: !Ref ExecutionRole
MemorySize: !Ref FunctionMemory
Timeout: !Ref FunctionTimeout
Code:
S3Bucket: !Ref CodeBucket
S3Key: !Ref CodeKey
Environment:
Variables:
LOG_LEVEL: INFO
DATABASE_URL: !Ref DatabaseUrl
Tags:
- Key: Environment
Value: !Ref Environment
Apply least privilege IAM policies:
Resources:
ExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service: lambda.amazonaws.com
Action: sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Policies:
- PolicyName: S3ReadAccess
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- s3:GetObject
Resource: !Sub "${DataBucket.Arn}/*"
Configure triggers for Lambda invocation:
Resources:
# S3 event source
S3EventSource:
Type: AWS::Lambda::EventSourceMapping
Properties:
EventSourceArn: !GetAtt DataBucket.Arn
FunctionName: !Ref LambdaFunction
# SQS event source
SQSEventSource:
Type: AWS::Lambda::EventSourceMapping
Properties:
EventSourceArn: !GetAtt Queue.Arn
FunctionName: !Ref LambdaFunction
BatchSize: 10
MaximumBatchingWindowInSeconds: 5
Set up REST or HTTP API integration:
Resources:
# HTTP API integration
HttpApi:
Type: AWS::ApiGatewayV2::Api
Properties:
Name: !Sub "${AWS::StackName}-api"
ProtocolType: HTTP
Target: !Ref LambdaFunction
ApiIntegration:
Type: AWS::ApiGatewayV2::Integration
Properties:
ApiId: !Ref HttpApi
IntegrationType: AWS_PROXY
IntegrationUri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunction.Arn}/invocations"
Create function versions and aliases:
Resources:
LambdaVersion:
Type: AWS::Lambda::Version
Properties:
FunctionName: !Ref LambdaFunction
Description: !Sub "Version ${AWS::StackName} v1"
LambdaAlias:
Type: AWS::Lambda::Alias
Properties:
FunctionName: !Ref LambdaFunction
FunctionVersion: !GetAtt LambdaVersion.Version
Name: live
Enable CloudWatch logging and X-Ray tracing:
Resources:
LambdaFunction:
Type: AWS::Lambda::Function
Properties:
LoggingConfig:
LogGroup: !Ref LogGroup
TracingConfig:
Mode: Active
LogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: !Sub "/aws/lambda/${LambdaFunction}"
RetentionInDays: 7
Configure DLQ for failed invocations:
Resources:
DeadLetterQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: !Sub "${AWS::StackName}-dlq"
LambdaFunction:
Type: AWS::Lambda::Function
Properties:
DeadLetterConfig:
TargetArn: !GetAtt DeadLetterQueue.Arn
AWSTemplateFormatVersion: '2010-09-09'
Description: Lambda function with monitoring and DLQ
Parameters:
FunctionMemory:
Type: Number
Default: 256
AllowedValues: [128, 256, 512, 1024]
FunctionTimeout:
Type: Number
Default: 30
Resources:
ExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal: { Service: lambda.amazonaws.com }
Action: sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
LambdaFunction:
Type: AWS::Lambda::Function
Properties:
FunctionName: !Sub "${AWS::StackName}-function"
Runtime: nodejs20.x
Handler: index.handler
Role: !GetAtt ExecutionRole.Arn
MemorySize: !Ref FunctionMemory
Timeout: !Ref FunctionTimeout
Code:
S3Bucket: !Ref CodeBucket
S3Key: !Ref CodeKey
Environment:
Variables:
LOG_LEVEL: INFO
LambdaVersion:
Type: AWS::Lambda::Version
Properties:
FunctionName: !Ref LambdaFunction
LambdaAlias:
Type: AWS::Lambda::Alias
Properties:
FunctionName: !Ref LambdaFunction
FunctionVersion: !GetAtt LambdaVersion.Version
Name: live
Outputs:
FunctionArn:
Value: !GetAtt LambdaFunction.Arn
FunctionName:
Value: !Ref LambdaFunction
* in Resource policies; always scope to specific resourcesFor detailed implementation guidance, see:
development
Provides final code cleanup after task review approval. Removes debug logs, temporary comments, dead code, optimizes imports, and improves readability. Use when asked to clean up code, polish, finalize, tidy up, remove technical debt, or prepare code for completion after review. Not for refactoring logic or fixing bugs—focused solely on cosmetic and hygiene cleanup.
tools
Ralph Wiggum-inspired automation loop for specification-driven development. Orchestrates task implementation, review, cleanup, and synchronization using a Python script. Use when: user runs /loop command, user asks to automate task implementation, user wants to iterate through spec tasks step-by-step, or user wants to run development workflow automation with context window management. One step per invocation. State machine: init → choose_task → implementation → review → fix → cleanup → sync → update_done. Supports --from-task and --to-task for task range filtering. State persisted in fix_plan.json.
testing
Creates, updates, validates, and displays the architectural DNA of a project through two shared documents: docs/specs/architecture.md (technology stack, architectural rules, security constraints, AI guardrails) and docs/specs/ontology.md (domain glossary / Ubiquitous Language). Use BEFORE brainstorm as a project setup step, or at any point in the SDD lifecycle to validate specs/tasks against architecture principles. Triggers on 'create constitution', 'update constitution', 'constitution check', 'validate against constitution', 'project principles', 'architectural guardrails', 'setup project architecture', 'define ontology'.
tools
Provides Qwen Coder CLI delegation workflows for coding tasks using Qwen2.5-Coder and QwQ models, including English prompt formulation, execution flags, and safe result handling. Use when the user explicitly asks to use Qwen for tasks such as code generation, refactoring, debugging, or architectural analysis. Triggers on "use qwen", "use qwen coder", "delegate to qwen", "ask qwen", "second opinion from qwen", "qwen opinion", "continue with qwen", "qwen session".