Cloudwatch on AWS Lamda and Gateway

I recently tested my newly created API Gateway pointing at Lamda using

npx aws-api-gateway-cli-test
npx: installed 110 in 13.123s
Authenticating with User Pool
Getting temporary credentials
Making API request
{ status: 403,
statusText: 'Forbidden',
data: { message: 'Forbidden' } }

The goals

  1. Adding Cloudwatch to API Gateway
  2. Adding Cloudwatch to Lamda’s

Part one — create the API Gateway Role and get ARN

  1. Go into IAM
  2. Open Roles
  3. Click Create Role
  4. Select API Gateway
  5. Complete the wizard and capture the ARN reference

Part 2 — Add the ARN to your API Gateway

Go to the API Gateway you want to log, and open settings to see:

Part3 — Turn on the logging

Looking at the logs

Gateway logs

I’ve found that AWS surfaces these logs in a lot of places. The first and easiest place to find is in Cloudwatch itself.

Lamda Logs

If you open up a log group for the lamda you see this

Logs from the CLI

One thing I found that I liked was the serverless logs command. Though I’ll say this now, if like me you have some STDOUT issue on GIT Bash… then use cmd.exe (windows life) or you get diddly squat.

serverless logs -f create --tail

Fullish-stack engineer ( and Lead front-end engineer @Cinch with 20 developing stuff for things with screens since the turn of the millenium.