{"id":2524,"date":"2017-12-11T12:40:21","date_gmt":"2017-12-11T18:40:21","guid":{"rendered":"http:\/\/www.mooreds.com\/wordpress\/?p=2524"},"modified":"2017-12-11T12:42:19","modified_gmt":"2017-12-11T18:42:19","slug":"debugging-options-for-aws-lambda-functions","status":"publish","type":"post","link":"https:\/\/www.mooreds.com\/wordpress\/archives\/2524","title":{"rendered":"Debugging options for AWS Lambda functions"},"content":{"rendered":"<p><a href=\"https:\/\/aws.amazon.com\/lambda\/\">AWS Lambda<\/a>\u00a0lets you write a &#8216;function as a service&#8217;, and run code from 100ms to 5 minutes in execution time without maintaining any servers.\u00a0 This code has few limitations, but one of the issues I&#8217;ve always encountered is debugging lambda functions.<\/p>\n<p>I mentioned it at a past meetup and encountered the following solutions:<\/p>\n<ul>\n<li>Plain old <a href=\"http:\/\/docs.aws.amazon.com\/lambda\/latest\/dg\/monitoring-functions-logs.html\">print statement debugging to cloudwatch logs<\/a>.\u00a0 Sometimes the simplest option is the best.<\/li>\n<li>Using <a href=\"https:\/\/github.com\/awslabs\/aws-sam-local\">samlocal<\/a>, which replicates the AWS Lambda runtime environment locally.<\/li>\n<li><a href=\"http:\/\/docs.aws.amazon.com\/cloud9\/latest\/user-guide\/lambda-functions.html\">Leveraging Cloud9<\/a>, the <a href=\"https:\/\/techcrunch.com\/2017\/11\/30\/amazon-launches-aws-cloud9-a-browser-based-ide-for-cloud-developers\/\">newly released AWS code editor in the cloud<\/a><\/li>\n<li><a href=\"http:\/\/docs.aws.amazon.com\/lambda\/latest\/dg\/lambda-x-ray.html\">Using X-ray<\/a> to trace and inspect code in Lambda.<\/li>\n<\/ul>\n<p>I think the right debugging option depends on the complexity of your code and the urgency of the situation, but could see using all of these at different times.<\/p>\n<p>Bonus: here&#8217;s a post on how to <a href=\"https:\/\/aws.amazon.com\/blogs\/compute\/continuous-deployment-for-serverless-applications\/\">continuously deploy your lambda functions<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AWS Lambda\u00a0lets you write a &#8216;function as a service&#8217;, and run code from 100ms to 5 minutes in execution time without maintaining any servers.\u00a0 This code has few limitations, but [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[79],"tags":[],"class_list":["post-2524","post","type-post","status-publish","format-standard","hentry","category-aws"],"_links":{"self":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/2524","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2524"}],"version-history":[{"count":3,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/2524\/revisions"}],"predecessor-version":[{"id":2526,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/2524\/revisions\/2526"}],"wp:attachment":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}