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


GitHub Launches Enterprise Data Residency
30/09/2024

GitHub has announced an option offering tighter control over where data is stored to meet regional requirements. The GitHub Enterprise Cloud data residency feature will launch on October 29 for the Eu [ ... ]



Does AI Help or Hinder?
02/10/2024

After early indications that AI-powered coding assistants increase developer productivity, findings are emerging that challenge this and suggest code quality may be reduced by their use. At the same t [ ... ]


More News

espbook

 

Comments




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



Last Updated ( Tuesday, 03 January 2017 )