At A Glance Main Projects Tutorials Resume

Contact


Email: palen1c at gmail.com




Debugging Tip For Node on AWS Lambda Edge

Mon, 13 Aug 2019 11:54:52 EST

Lambda is hands down my favorite AWS service. The capability to run serverless functions on demand and at scale is very powerful. A more recent capability of Lambda is that it can be run in response to certain Cloud Front events. AWS Cloud Front is a content delivery network. This integration of Lambda is referred to as Lambda Edge. You can use Lambda Edge the same way that you use normal Lambda. However, as a trigger you select Cloud Front and select the associated distribution and events to use as triggers.

Amazon Web Services Lambda.
When you use Cloud Front as a trigger, you can then access the option within your latest Lambda function to deploy to Lambda@Edge. This option will deploy your Lambda function across the Cloud Front edge servers kind of like a Cloud Front invalidation.

Amazon Web Services Lambda With Deploy to Edge.
This is where it becomes a little more complex. Thankfully the same code is deployed to all edge servers.

Cloud Watch Regions.
The biggest tip is to use CloudWatch logs to see if your functions are running. The big catch here is that your CloudWatch logs will be within the region of the originating requests. There are a LOT of regions. Thankfully you can do simple logging in Lambda by typical language console output methods. For Node Console.log will do the job. For Java System.out.println and the like will get output into your CloudWatch logs.

Amazon Cloud Watch Logs.
Also, watch out for lagging code deployment. As of August, 2019 I have experienced lagging edge deployments when using "Deploy to Lambda@Edge". I waited a day and the correct code was magically running.

Charles Palen has been involved in the technology sector for several years. His formal education focused on Enterprise Database Administration. He currently works as the principal software architect and manager at Transcending Digital where he can be hired for your next contract project. Charles is a full stack developer who has been on the front lines of small business and enterprise for over 10 years. Charles current expertise covers the areas of .NET, Java, PHP, Node.js, Javascript, HTML, and CSS. Charles created Technogumbo in 2008 as a way to share lessons learned while making original products.

Comments

No one has posted any comments yet, be the first

Comments are currently disabled.