How to Monitor AWS Lambda with Vigilmon
AWS Lambda is the backbone of serverless architectures — but invisible cold starts, silent function errors, and timeout failures can devastate user experience without a trace. This guide shows how to monitor your Lambda-backed APIs and endpoints with Vigilmon.
Why Lambda Monitoring Matters
Lambda functions fail silently in ways traditional servers don't:
- Cold start latency spikes (500ms–2s+ for large runtimes)
- Memory limit exceeded — function crashes without HTTP response
- Timeout — function hits 15-minute limit mid-execution
- Concurrent execution limit — throttling returns 429s
- Downstream failures — DynamoDB, RDS, or SQS errors propagate
Vigilmon monitors the externally visible behavior of your Lambda endpoints — exactly what your users experience.
Step 1: Add a Health Endpoint to Your Lambda API
Express.js on Lambda (with Serverless Framework)
const serverless = require('serverless-http')
const express = require('express')
const app = express()
app.get('/health', async (req, res) => {
const health = {
status: 'ok',
service: 'my-lambda-api',
region: process.env.AWS_REGION,
timestamp: new Date().toISOString()
}
// Check DynamoDB connectivity
try {
const { DynamoDBClient, ListTablesCommand } = require('@aws-sdk/client-dynamodb')
const client = new DynamoDBClient({})
await client.send(new ListTablesCommand({ Limit: 1 }))
health.dynamodb = 'ok'
} catch (err) {
health.dynamodb = 'error'
health.status = 'degraded'
}
res.status(health.status === 'ok' ? 200 : 503).json(health)
})
module.exports.handler = serverless(app)
Python Lambda (FastAPI via Mangum)
from fastapi import FastAPI
from mangum import Mangum
import boto3
import os
app = FastAPI()
@app.get("/health")
async def health_check():
status = "ok"
checks = {}
# Check DynamoDB
try:
client = boto3.client('dynamodb')
client.list_tables(Limit=1)
checks['dynamodb'] = 'ok'
except Exception as e:
checks['dynamodb'] = 'error'
status = 'degraded'
return {
"status": status,
"region": os.environ.get('AWS_REGION'),
"checks": checks
}
handler = Mangum(app)
Step 2: Configure API Gateway
Ensure your health endpoint is accessible via API Gateway:
# serverless.yml
functions:
api:
handler: src/handler.handler
timeout: 30
memorySize: 512
events:
- http:
path: /health
method: get
cors: true
- http:
path: /{proxy+}
method: any
cors: true
Step 3: Monitor with Vigilmon
- Sign up at vigilmon.online
- Click New Monitor → HTTP(S)
- Enter your API Gateway URL:
https://abc123.execute-api.us-east-1.amazonaws.com/prod/health - Set interval to 1 minute
- Expected status: 200
- Set timeout to 10 seconds (catches Lambda cold start issues)
Step 4: Monitor Multiple Lambda Stages
Set up separate monitors for each environment:
| Environment | URL | Monitor |
|---|---|---|
| Production | https://api.example.com/health |
1-min interval |
| Staging | https://api-staging.example.com/health |
5-min interval |
| Dev | https://dev.execute-api.../health |
15-min interval |
Step 5: Alert on Cold Start Degradation
Vigilmon tracks response time history. Configure alerts when response time exceeds a threshold:
- Warning: response time > 2000ms (cold start detected)
- Critical: response time > 5000ms or status != 200
This helps you identify when to implement Lambda SnapStart (Java) or provisioned concurrency.
Step 6: SSL Certificate Monitoring for Custom Domains
If your Lambda API uses a custom domain (via API Gateway custom domain names), Vigilmon monitors the SSL certificate and alerts you 30 days before expiry — so ACM certificate auto-renewal issues don't cause unexpected downtime.
Common Lambda Issues Vigilmon Catches
- Deployment failures — new version deployed breaks the endpoint → immediate alert
- VPC misconfiguration — Lambda can't reach RDS inside VPC → 503s
- IAM permission errors — missing role permissions → function crashes
- Environment variable missing — misconfigured secrets → 500s on startup
- Package size limit — deployment artifact too large → invocation fails
Summary
Vigilmon gives you the external-perspective monitoring that CloudWatch alone can't provide. CloudWatch tells you Lambda ran — Vigilmon tells you whether it actually responded correctly to users.
Start monitoring your Lambda API for free →
Related: How to Monitor Google Cloud Run with Vigilmon | How to Monitor Your Serverless App with Vigilmon
Top comments (0)