{"id":4813,"date":"2022-09-02T09:00:00","date_gmt":"2022-09-02T07:00:00","guid":{"rendered":"https:\/\/blog.besharp.it\/?p=4813"},"modified":"2022-09-05T14:14:04","modified_gmt":"2022-09-05T12:14:04","slug":"building-a-deno-serverless-application-using-lambda-custom-runtime-cdk","status":"publish","type":"post","link":"https:\/\/blog.besharp.it\/building-a-deno-serverless-application-using-lambda-custom-runtime-cdk\/","title":{"rendered":"Building a Deno Serverless Application using Lambda Custom Runtime & CDK"},"content":{"rendered":"\n

Introduction<\/h2>\n\n\n\n

Welcome back to Proud2beCloud, the blog by beSharp<\/a>! Today we\u2019ll be exploring some capabilities offered by the Cloud with a focus on customization<\/strong> while always relying on Infrastructure-as-Code (IaaC)<\/strong>, Serverless<\/strong>, and managed services<\/strong>. We\u2019ll talk about Lambda, CDK, pipelines, Serverless Repository, and more.<\/p>\n\n\n\n

AWS Lambda Functions (FaaS) are great and versatile tools of the AWS Cloud that can be useful in many different situations and applications.<\/p>\n\n\n\n

But how can we leverage them if we want to leverage a programming language that is not already supported? The answer is easy: Custom Runtime<\/strong>.<\/p>\n\n\n\n

We\u2019ve already seen in one of our previous articles<\/a> how to create an application C++ on AWS Lambda. Now, two years later, we want to present a new version of the article choosing another vastly talked about a programming language: Deno<\/strong>.\u00a0<\/p>\n\n\n\n

We\u2019ll also focus on how to automate the delivery of our application on Lambda thanks to pipelines CI\/CD and CDK<\/strong>.<\/p>\n\n\n\n

Custom runtime on Lambda<\/h3>\n\n\n\n

As previously stated, if you are an assiduous reader of our blog, you probably already know about the possibility to use custom runtime on Lambda<\/a>.<\/p>\n\n\n\n

To quickly summarize: Lambda with a custom runtime differs from a \u2018standard\u2019 lambda function because it must contain, other than the source code of the application, all the libraries needed for the execution and to resolve dependencies. Furthermore, if the language is interpreted, the interpreter is also needed in the package. <\/p>\n\n\n\n

Using a custom runtime for AWS Lambda guarantees the elasticity<\/strong> of the proposed solutions for the resolution and optimization of the problem that might require a specific programming language.<\/p>\n\n\n\n

The previous article described in detail how to create a custom runtime from scratch defining all the bootstrap scripts needed. In Today\u2019s article, we\u2019ll simplify the process further through the use of ready-to-use and reusable elements<\/strong> when possible.<\/p>\n\n\n\n

In fact, for the most part of programming languages, it is likely that a custom runtime already exists and is ready to use or at least a good starting point for a custom solution. They are usually shared via Git or other sharing platforms. In our case, we\u2019ll use an existing runtime of Deno.<\/p>\n\n\n\n

What\u2019s Deno<\/h3>\n\n\n\n

Deno<\/a> is a runtime for Javascript<\/strong>, Typescript<\/strong>, and WebAssembly<\/strong> based on JS Engine and Rust that has the role of both runtime and package manager. With Deno it is not necessary to have a separate package manager.<\/p>\n\n\n\n

Deno aims to be a secure and reliable scripting environment, intuitive for the developer.<\/strong> It is open-source under an MIT license.<\/p>\n\n\n\n

Like Node.js, Deno focuses on an event-driven architecture<\/strong> and can be used to create web servers, execute scientific computation, and other solutions.<\/p>\n\n\n\n

Deno differs from Node.js in various aspects:<\/p>\n\n\n\n