This is a robust but simple cli script to check Lambda health using most efficient way. It verifies Lambda health using two distinct signals:
- Configuration State: Is the function Active and Successful? (Deployability check)
- Runtime Health: Has it generated Errors in CloudWatch recently? (Operational check)
This script retrieves all functions (or filters by a pattern), checks their deployment state, and queries CloudWatch for error metrics over the last 10 minutes.
Save the script as lambda_healthcheck.sh and make it executable.
chmod +x lambda_healthcheck.shThen run it directly or filter by function name pattern:
# Check all functions
./lambda_healthcheck.sh
# Check only functions containing "payment"
./lambda_healthcheck.sh payment