
Aws Lambda Functions
Create, configure, and invoke AWS Lambda functions with IAM roles, zip deploys, and Node.js handlers using AWS CLI patterns.
Overview
AWS Lambda Functions is an agent skill for the Build phase that provides AWS CLI and Node.js recipes to create IAM roles, deploy zipped Lambdas, and invoke functions with JSON payloads.
Install
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill aws-lambda-functionsWhat is this skill?
- IAM execution role creation with lambda.amazonaws.com trust and AWSLambdaBasicExecutionRole attach
- aws lambda create-function from ZIP with runtime, handler, timeout, memory, and environment Variables
- aws lambda invoke with JSON payload and response file capture
- Node.js handler template parsing API Gateway body JSON and S3 Records event branches
Adoption & trust: 518 installs on skills.sh; 251 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need a working Lambda quickly but keep stumbling on IAM trust policies, zip packaging flags, and handler event parsing.
Who is it for?
Indie builders hooking a small API or event processor on AWS who want agent-guided CLI setup before adopting SAM, CDK, or full CI pipelines.
Skip if: Multi-region Terraform/CDK estates or teams forbidden from shell AWS access—use IaC-first skills instead of CLI-only flows.
When should I use this skill?
You need AWS CLI steps to create a Lambda IAM role, deploy a zipped function, set env vars, or implement a Node.js handler for API/S3-shaped events.
What do I get? / Deliverables
Your agent outputs ordered CLI steps and a starter handler so you have a created function, configured env vars, and a successful local invoke against a response file.
- IAM role and Lambda create-function command sequence
- Node.js handler scaffold with event parsing branches
- Invoke command and local response.json capture pattern
Recommended Skills
Journey fit
Build is where serverless functions are authored and wired to AWS; IAM and invoke loops happen before you treat the function as production-operated. Integrations fits Lambda as an AWS service hook (API, S3 events, env-driven config) rather than pure application UI or docs work.
How it compares
CLI-and-handler prompt pack—not a managed deploy workflow or local Lambda emulator skill.
Common Questions / FAQ
Who is aws-lambda-functions for?
Solo developers using Claude Code, Cursor, or Codex who deploy or debug single Lambda functions via AWS CLI and Node.js handlers.
When should I use aws-lambda-functions?
During Build when creating execution roles, packaging zip artifacts, setting environment variables, wiring S3 or HTTP-shaped events, or smoke-testing with lambda invoke.
Is aws-lambda-functions safe to install?
Commands touch IAM and live AWS APIs—check the Security Audits panel on this Prism page, scope credentials narrowly, and never paste production secrets into prompts.
SKILL.md
READMESKILL.md - Aws Lambda Functions
# Basic Lambda Function with AWS CLI ## Basic Lambda Function with AWS CLI ```bash # Create Lambda execution role aws iam create-role \ --role-name lambda-execution-role \ --assume-role-policy-document '{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": {"Service": "lambda.amazonaws.com"}, "Action": "sts:AssumeRole" }] }' # Attach basic execution policy aws iam attach-role-policy \ --role-name lambda-execution-role \ --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole # Create function from ZIP zip function.zip index.js aws lambda create-function \ --function-name my-function \ --runtime nodejs18.x \ --role arn:aws:iam::ACCOUNT:role/lambda-execution-role \ --handler index.handler \ --zip-file fileb://function.zip \ --timeout 30 \ --memory-size 256 \ --environment Variables={ENV=production,DB_HOST=db.example.com} # Invoke function aws lambda invoke \ --function-name my-function \ --payload '{"name":"John","age":30}' \ response.json ``` # Lambda Function with Node.js ## Lambda Function with Node.js ```javascript // index.js exports.handler = async (event) => { console.log("Event:", JSON.stringify(event)); try { // Parse different event sources const body = typeof event.body === "string" ? JSON.parse(event.body) : event.body || {}; // Process S3 event if (event.Records && event.Records[0].s3) { const bucket = event.Records[0].s3.bucket.name; const key = event.Records[0].s3.object.key; console.log(`Processing S3 object: ${bucket}/${key}`); } // Database query simulation const results = await queryDatabase(body); return { statusCode: 200, headers: { "Content-Type": "application/json", "Access-Control-Allow-Origin": "*", }, body: JSON.stringify({ message: "Success", data: results, }), }; } catch (error) { console.error("Error:", error); return { statusCode: 500, body: JSON.stringify({ error: error.message }), }; } }; async function queryDatabase(params) { // Simulate database call return { items: [] }; } ``` # Lambda Layers for Code Sharing ## Lambda Layers for Code Sharing ```bash # Create layer directory structure mkdir -p layer/nodejs/node_modules cd layer/nodejs # Install dependencies npm install lodash axios moment # Go back and create zip cd .. zip -r layer.zip . # Upload layer aws lambda publish-layer-version \ --layer-name shared-utils \ --zip-file fileb://layer.zip \ --compatible-runtimes nodejs18.x ``` # Lambda with SAM (Serverless Application Model) ## Lambda with SAM (Serverless Application Model) ```yaml # template.yaml AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 Globals: Function: Timeout: 30 MemorySize: 256 Runtime: nodejs18.x Tracing: Active Parameters: Environment: Type: String Default: dev AllowedValues: [dev, prod] Resources: # Lambda function MyFunction: Type: AWS::Serverless::Function Properties: FunctionName: !Sub "${Environment}-my-function" CodeUri: src/ Handler: index.handler Architectures: - x86_64 Environment: Variables: STAGE: !Ref Environment Policies: - DynamoDBCrudPolicy: TableName: !Ref DataTable - S3CrudPolicy: BucketName: !Ref DataBucket Events: ApiEvent: Type: Api Properties: Path: /api/{proxy+} Method: ANY RestApiId: !Ref MyApi S3Upload: Type: S3 Properties: Bucket: !Ref DataBucket Events: s3:ObjectCreated:* Filter: S3Key: Rules: - Name: prefix Value: uploads/ # DynamoDB table DataTable: Type: AWS::Dy