Skip to main content

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 via aws lambda list-functions --query "Functions[?contains(FunctionName, 'PostConfirmation')]")

Key Functions by Component

FunctionPurposeTrigger
{env}-EcomIndexerFunctionIndex products into MarqoSQS (per-shop queues)
{env}-EcomSettingsExporterLambdaSync settings to Cloudflare KVDDB Stream on IndexSettingsTable
{env}-EcomMetricsWorkerProcess search metricsSQS (metrics queue)
{env}-EcomMonitoringServiceLambdaCheck alarms exist for indexesEventBridge (every 10 min)
{env}-ShopifyAppAdminFunctionShopify admin APIAPI Gateway
{env}-ShopifyWebhookWorkerAsync webhook processingInvoked by Admin Function
{env}-AdminLambdaAdmin dashboard APIAPI Gateway
MerchandisingExporterLambda-{env}Sync merchandising to CF KVEventBridge (every 5 min)
ControllerAuthLambda-{env}Auth for controller APIAPI Gateway authorizer

What to Look For

SymptomCheck
Function errorsaws logs filter-log-events with ERROR filter on the function's log group
TimeoutCheck Timeout in function config vs actual duration in logs
ThrottlingCheck CloudWatch metric Throttles for the function
SQS not drainingCheck event source mapping state: aws lambda list-event-source-mappings
DDB stream backlogCheck IteratorAge metric on the settings exporter