Deploying a serverless application with Nest.js - amazon-web-services

I have an application using Nest.js, and I'd like to deploy it using API Gateway + Lambda functions.
I have some experience with AWS, but it's my first time with a serverless application.
I searched for some things but almost everything that I found uses the Serverless framework, and I would like to do it using the AWS SDK.
I have an API with 4 endpoints, I want to use API Gateway and a single Lambda function to run the application.
Any tips on how I could do that?
Thanks in advance.

Related

Google Cloud Platform API Gateway in serverless Framework?

I'm currently looking for a example of implementing API gateway for GCP using the serverless framework, similar to how one would use it with AWS, has anyone successfully implemented a solution like this using the framework? I've looked a decent amount for an example but the serverless docs don't seem to have an example, so I wonder if it is even possible as of right now with the serverless framework.

Migrating from Spring Boot Microservices Project to Serverless using AWS

I have created a Spring cloud microservices project with netflix APIs and a frontend with React. Now, I want to migrate this project to serverless using amazon web services with DynamoDB and cognito. Do you know, which steps should I follow to do that? And what should I consider before doing this migration? For the Frontend React I decided to use S3 to host it.
Be sure if u really want to do this . This will be a big project; almost like re-writing complete codebase. Good part is that lambda supports Java so u might end up doing lots of copy paste. You would have a lambda function of each REST api endpoint u were exposing.

How to deploy a SpringBoot microservice application(RESTful) as serverless to AWS Lambda?

I have developed a simple microservice, REST based using Java 8 and Spring Boot2.0. It has its own REST end points which I can call using Postman and I get the response very well. Now I have doubt in understanding the design & architecture if I want to deploy the same application on AWS cloud. I want my application to behave as serverless so I want to deploy on AWS using its Lambda service.
Please assist to clear my following doubts :-
1) First, can I upload my whole application code to AWS Lambda in order to make it serverless?
2) If yes, then do I need to use AWS API Gateway (compulsorily) to invoke my Lambda function when the request passes through it?
3) If yes (point 2), then end points which are there in my original microservice code will become ineffective and will be overridden by new API Gateway end points?
My whole doubt is about end points, which end point will be used to invoke the Lambda functions?
Please assist to clarify my doubt. If there is any sample reference material then it will be really great.
Cheers
Spring Boot and AWS Lambda don't naturally go together IMO.
Lambda is pure code, it does not present itself as a HTTP Server, it is just triggered by one of the other AWS services (API Gateway, CloudWatch, S3, DynamoDB, Kinesis, SDK, etc.). The handler receives a JSON request from the calling service, and processes the request. Here is an example.
API Gateway does much of what Spring Boot provides for you. API Gateway is always online waiting for HTTP requests to come in, for which you only pay for incoming requests, you do not pay for idle (the definition of serverless IMO).
Once a request comes in, API Gateway wraps the request payload with some additional environmental data and sends it to your Lambda handler, which processes the request and returns some response to the client.
Saying that, if you don't want to restructure your service, there are a couple of options open to you:
Wrap into a Docker image and use an AWS Container Service, either using ECS or ElasticBeanstalk, neither of these are considered to be serverless.
I have not tried this, but according to AWS:
You can use the aws-serverless-java-container library to run a Spring Boot application in AWS Lambda. You can use the library within your Lambda handler to load your Spring Boot application and proxy events to it.
See links to Convert your SpringBoot project and Deploy it to AWS Lambda.
Hope this helps.

AWS API Gateway with EC2

I have a Django Project deployed in AWS EC2 and have created all the REST APIs with DRF. Everything is working great. When I point public.ip.of.ec2:8000/myapi, I get the correct response and these APIs are used in Android application.
Now, day by day the API hits will be increased. So in order to maintain API requests I want to integrate my APIs with APIGateway. After a lot of reading and searching I still could not find any definitive tutorial or steps as of how to integrate APIGateway with EC2.
I've followed this but still could not integrate APIGateway with AWS Service i.e., EC2.
Please suggest a way to do this.
I have a Django Project deployed in AWS EC2 and have created all the
REST APIs with DRF. Everything is working great. When I point
public.ip.of.ec2:8000/myapi, I get the correct response
Integration type you are looking for is HTTP integration
Now, day by day the API hits will be increased. So in order to
maintain API requests I want to integrate my APIs with APIGateway
Although you can configure API caching, throttling, logging and monitoring, AWS API Gateway won't scale your backend integration. You will need to configure autoscaling on backend service as well.

What is the recommended way of creating Serverless (or) AWS lambda functions on the fly

I'm creating a SaaS product which allows users to create their own apps. For each application I need to deploy a serverless app or just a lambda function with cloud watch events & api gateway configurations through cloud formation stack when a particular request hits my backend API (which is also a serverless application). I need to know the best practice or the recommended way of achieving that task.
There are two approaches I found by doing a bit of research.
1. Using aws sdk and create a cloud formation stack. (without using the serverless framework)
2. Using serverless-platform-sdk which deploys an app on serverless-platform (beta) which I'm not completely sure about.