Everything went as planned, but what happens when it does not? Every call to our https://bwxuad56tl endpoint is recorded in a CloudWatch log. In order to check it we have to pick the CloudWatch service->Logs, and the relevant API-Gateway-Execution-Logs, in this case API-Gateway-Execution-Logs_bwxuad56tl/prod
click on the latest log stream:
and be unfortunately confronted with a No events found message and with not sign of our call's recording.
What could be the matter?
The matter is that we must also activate our CloudWatch log monitoring, so back to the API Gateway dashboard in order to change the production stage of our API, 'Stage->prod', from:
If while on it you get a CloudWatch Logs role ARN must be set in account settings to enable logging
then in the Setting tab of our API Gateway dashboard, enter a role ARN (ARN is just a unique 'serial' number that is assigned to each individual resource) that has permissions to write to the logs. Well we've already have done that, it's the 'lambda_basic_execution_helloWorldNodeJs' role we had created in the very beginning of our tutorial.
In order to get it's ARN you have to navigate to the AWS Security, Identity & Compliance->IAM service dashboard, pick the role from the list and copy its ARN.Then back to the API Gateway dashboard to paste it into the CloudWatch log role ARN input box
Back to Postman for one final test. Fire the same request again and navigate to the CloudWatch Logs once more.We instantly know that something went right since we observe that the Last Event Time entry has been filled with a time-stamp.
Picking the stream reveals the fruits of our effort in a detailed backlog recording of our call.
Thus, we set up, called, received, recorded, therefore at this point we conclude the first part of our 'AWS for the Impatient' tutorial series, which took us through the process of creating our very first function and calling it through an open, public, unrestricted and unauthenticated endpoint.The next part will be more involved as, despite it talking about the very same Lambda function, it now calls it through authenticated calls tied to an IAM profile.