Deploy Lambda REST API with Deno ??
Deploy Lambda REST API with Deno

Deploy Lambda REST API with Deno ??

Hello ????,

My name is Andrei, I am a Senior NodeJS Developer & AWS Architect Consultant / Contractor / Freelancer.

This post will guide you through designing a multi-endpoint lambda manager using Deno?? ?? by implementing AWS API Gateway (authenticated with Cognito) + AWS Lambda (for the processing layer) + AWS DyanmoDB (for the data storage layer).?

As Christmas is just 2 months away, the application we’ll build is about the Christmas market event. (small houses around the city with Christmas theme products).

No alt text provided for this image

The architecture and the application flow are already present in this article posted two weeks ago.

I like this way of creating lambdas and consider it a valid solution to avoid having one lambda for one method as long as you do not create a big monolith function.

Last week I posted the same design pattern but using NodeJS. The deno version is inside a different lambda folder with the prefix “deno_”. (Repository Link)

No alt text provided for this image


Why Deno ???

Deno is a TypeScript runtime based on V8, Google's JavaScript runtime, like Node.js.

It supports TypeScript natively ??

It doesn't have a centralized package manager like npm ??

We could say that?Deno is the improved version of Node, which is a faster, more secure, and more modern tool to build apps. ??????

For more tutorials about getting started with Deno, you can use the official documentation.

___________________

Prerequisites:

  • An AWS Account
  • AWS CLI configured with the AWS Account
  • AWS SAM to deploy the template

___________________

How the Deno works on lambda?

As Deno is not available as an official runtime, it is needed to create a custom runtime.

There is already a custom runtime kept up-to-date created by Andy Hayden ????????. The runtime is shared as a Serverless App Repository. (link)

Official repository & documentation: https://github.com/hayd/deno-lambda

The Makefile and the Cloudformation Lambda template have been updated in order to deploy the lambda successfully.

The DynamoDB wrapper has been updated in order to support the DynamoDB version of the deno library.

Deployment command: ??

sam build -t cloudformation/main.yaml && sam deploy --capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND        
No alt text provided for this image
No alt text provided for this image

__________________

That’s it! A simple AWS Lambda with Deno ?? that you can use inside your projects! ??

I hope it could help your journey into the AWS world ??

The deno_* lambda can be used as a starting development environment.

If you need any help or considerations, feel free to drop me a message ??

Pietro Diliberto

Information Technology Services Specialist presso Italdesign

2 年

I was waiting Monday for this!

要查看或添加评论,请登录

Andrei Marius Diaconovici的更多文章

社区洞察

其他会员也浏览了