In this article, We will be looking at how to migrate an AWS lambda function deployed as a Serverless application into a Pulumi project without modifying the underlying lambda code.
This article assumes that you have a basic understanding of serverless framework and .
You can find the complete code for this article on GitHub.
Let us first imagine that we have a serverless application with a single lambda function ( createTodo
) deployed in AWS. To make it interesting, we will use the code from typescript todo rest api example serverless examples repository.
The project structure could look something like this:
todos-api
├─ .eslintrc.json
├─ functions
│ └─ create.ts
├─ package.json
├─ package-lock.json
├─ serverless.yml
└─ tsconfig.json
serverless.yml
could look as follows:
And we deploy with the following command
$ cd todos-api
$ serverless deploy
This would create the following AWS resources:
_/new_
POST endpoint integrated with the functionAfter we implement the Lambda function with Pulumi, we will have pretty much the same set of resources, except for the:
So you can remove them after you’ve moved your function.
#serverless #pulumi #nodejs #aws-lambda