Strands Agents SDK Deploy — Serverless Deployment to AWS Lambda
Deploy a Strands Agents SDK agent to AWS Lambda using the official Lambda Layer. Measured cold start Init Duration at ~1 second and warm start at under 1 second.
Content tagged with "lambda"
Deploy a Strands Agents SDK agent to AWS Lambda using the official Lambda Layer. Measured cold start Init Duration at ~1 second and warm start at under 1 second.
Deployed AWS Lambda Managed Instances and measured 67s provisioning, auto-distribution across 10 execution environments with multi-concurrency, and throttling under CPU load. Includes an LMI migration checklist.
Built a CloudWatch Alarm → SNS → Lambda → Generic Webhook pipeline to auto-trigger DevOps Agent investigations. Verified HMAC signature implementation, measured alarm-to-investigation latency (~65s), and discovered that duplicate incidentIds are linked rather than deduplicated.
Verified DevOps Agent's EventBridge integration. Captured Investigation lifecycle events and built a pipeline to auto-send investigation summaries via SNS. Documents implementation gotchas including IAM action prefix and Lambda boto3 bundling.
SAM deployment gotchas, local testing with LocalDurableTestRunner, and execution history tracking from hands-on experience. The qualified ARN requirement is the first hurdle.
Verified idempotency, DurableExecutionName, parallel callbacks, and timeout configuration hands-on. The common principle: design everything assuming replay will happen.
Deployed the official AWS fraud detection demo and verified 3 risk-score branches with suspend behavior. Confirmed zero compute charges during checkpoint-and-replay waits.
Implement same-AZ routing using Powertools getMetadata() in TypeScript. Verified caching behavior and clearMetadataCache() with real measurement data.
Hands-on verification of Lambda's new AZ metadata endpoint. Measured same-AZ vs cross-AZ latency to an ElastiCache Valkey cluster and quantified the routing benefit.
Verified Lambda Managed Instances Rust support. run_concurrent enables 8 parallel requests with 2.9ms init — effectively eliminating cold starts. Compared with standard Lambda.
Verified Lambda's GA Rust support with cargo-lambda. Cold start at 29ms, warm execution at 1.2ms — 90x faster than Python with 2.6x better memory efficiency.
Verified Step, Wait, Callback, and Parallel patterns via AWS CLI. Sharing checkpoint-replay behavior, gotchas, and when to choose Durable Functions over Step Functions.
Lambda's managed Python runtime may lack service models for new AWS services like DevOps Agent. Set PYTHONPATH=/var/task to prioritize the bundled boto3 over the managed runtime version.
Even when initializing the AWS SDK for Rust client during Lambda Init, the first API call takes ~900ms. Breakdown measurement revealed TLS handshake at 745ms accounts for 99%.
Invoking a Durable Function with an unqualified function name throws InvalidParameterValueException. Append $LATEST or use a published version number.
A Durable Function waiting for a callback reports RUNNING, not SUSPENDED. Check execution history for CallbackStarted events to determine actual state.
AWS docs show Powertools code for both Python and TypeScript, but Python 3.25.0 lacks the lambda_metadata module (ModuleNotFoundError). TypeScript @aws-lambda-powertools/commons 2.32.0 works.
Trying to add it via update-function-configuration fails with CapacityProviderConfig isn't supported for Lambda Default functions.
Invoke API with Tail returns an error. Use platform.report events in CloudWatch Logs to get Duration metrics.
EC2 FullAccess and even AdministratorAccess fail with InsufficientRolePermissions. A dedicated managed policy is required.
Some docs reference CheckpointDurableExecutions (plural), but the actual required action is singular. Plural form causes permission errors.
import { DurableContext } from '@aws/durable-execution-sdk-js' throws SyntaxError at runtime. Only import withDurableExecution for .mjs deployments.