Lambda
Quick Reference
# List functions matching a prefix
aws lambda list-functions --query "Functions[?starts_with(FunctionName, 'staging-')].[FunctionName,Runtime,MemorySize,Timeout]" --output table
# Get function config (env vars, role, handler)
aws lambda get-function-configuration --function-name staging-EcomIndexerFunction
# Get recent invocations via CloudWatch Logs
aws logs filter-log-events \
--log-group-name /aws/lambda/staging-EcomIndexerFunction \
--start-time $(date -v-15M +%s000) \
--filter-pattern "ERROR"
# Tail logs live
aws logs tail /aws/lambda/staging-EcomIndexerFunction --follow
# Check recent errors
aws logs filter-log-events \
--log-group-name /aws/lambda/staging-EcomIndexerFunction \
--start-time $(date -v-1H +%s000) \
--filter-pattern "?ERROR ?Traceback ?Exception"
# Check event source mappings (SQS triggers, DDB streams)
aws lambda list-event-source-mappings --function-name staging-EcomIndexerFunction
Function Naming Convention
Two naming conventions coexist:
- Ecom/Admin stack (CDK):
{env}-{FunctionName}(e.g.,staging-EcomIndexerFunction) - Controller stack (CDK):
{FunctionName}-{env}(e.g.,ControllerAuthLambda-staging) - Cognito triggers (CDK):
ControllerCognitoStack-{env_prefix}-{Name}{hash}(auto-generated, find viaaws lambda list-functions --query "Functions[?contains(FunctionName, 'PostConfirmation')]")
Key Functions by Component
| Function | Purpose | Trigger |
|---|---|---|
{env}-EcomIndexerFunction | Index products into Marqo | SQS (per-shop queues) |
{env}-EcomSettingsExporterLambda | Sync settings to Cloudflare KV | DDB Stream on IndexSettingsTable |
{env}-EcomMetricsWorker | Process search metrics | SQS (metrics queue) |
{env}-EcomMonitoringServiceLambda | Check alarms exist for indexes | EventBridge (every 10 min) |
{env}-ShopifyAppAdminFunction | Shopify admin API | API Gateway |
{env}-ShopifyWebhookWorker | Async webhook processing | Invoked by Admin Function |
{env}-AdminLambda | Admin dashboard API | API Gateway |
MerchandisingExporterLambda-{env} | Sync merchandising to CF KV | EventBridge (every 5 min) |
ControllerAuthLambda-{env} | Auth for controller API | API Gateway authorizer |
What to Look For
| Symptom | Check |
|---|---|
| Function errors | aws logs filter-log-events with ERROR filter on the function's log group |
| Timeout | Check Timeout in function config vs actual duration in logs |
| Throttling | Check CloudWatch metric Throttles for the function |
| SQS not draining | Check event source mapping state: aws lambda list-event-source-mappings |
| DDB stream backlog | Check IteratorAge metric on the settings exporter |