Create an AWS Lambda using Typescript
AWS Lambda does not natively support TypeScript. In this article, you are going to learn how to create a Typescript Lambda.
TypeScript is a superset of JavaScript, meaning all valid JavaScript code is also valid TypeScript code. As the name says Type+Script, adds optional static typing to the language.
TypeScript saves you time catching errors and providing fixes before you run code, which makes this a great framework to write your lambda function.
So you write code in TypeScript and then it’s converted in Node.js.
A Node.js lambda has better spin-up times than C# or Java.
Let's go for what really matters, write the lambda using Typescript.
Requirements
Project setup
- Open Visual Studio Code;
- View, Command Palette;
- Type “aws: Create new SAM Application”;
- Select the language (nodejs12.x);
- AWS Sam Hello World;
- Type a name for your project and that's it (mine is lambda)