AWS Lambda For The Impatient Part 1
Written by Nikos Vaggalis   
Monday, 02 January 2017
Article Index
AWS Lambda For The Impatient Part 1
The API Gateway
Actions and Testing
CloudWatch log files


Step 5 - CloudWatch log files

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:


to:



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.

 

lambdaicon

 

More Information

What Is AWS Lambda?

AWS Security Best Practices

Creating an AWS Lambda Function for a Custom Skill

AWS Lambda pricing

Related Articles

Health Level 7 (HL7) with Perl 

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


OpenAI Library For .NET Exits Beta
19/11/2024

A few months ago the OpenAI .NET library was released as a beta. It has now reached version 2.0.0 and the time has come to leave beta and, with a few amendments enter production readiness.



Improved Code Completion With JetBrains Mellum
29/10/2024

JetBrains has launched Mellum, a proprietary large language model specifically built for coding. Currently available only with JetBrains AI Assistant, Mellum is claimed to provide faster, sm [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info



Last Updated ( Tuesday, 03 January 2017 )