Punisher
Punisher

Reputation: 684

Server vs Serverless for REST API

I have a REST API that I was thinking about deploying using a Serverless model. My data is in an AWS RDS server that needs to be put in a VPC for security reasons. To allow a Lambda to access the RDS, I need to configure the lambda to be in a VPC, but this makes cold starts an average of 8 seconds longer according to articles I read.

The REST API is for a website so an 8 second page load is not acceptable.

Is there anyway I can use a Serverless model to implement my REST API or should I just use a regular EC2 server?

Upvotes: 0

Views: 485

Answers (1)

Nikolay Grishchenko
Nikolay Grishchenko

Reputation: 911

Unfortunately, this is not yet released, but let us hope that this is a matter of weeks/months now. At re:Invent 2018 AWS has introduced Remote NAT for Lambda to be available this year (2019).

For now you have to either expose RDS to the outside (directly or through a tunnel), but this is a security issue. Or Create Lambda ENIs in VPC.

In order to keep your Lambdas "warm" you may create a scheduled "ping" mechanism. Some example of this pattern you can find in the Article of Yan Cui.

Upvotes: 3

Related Questions