2

We have a web app that is powered by an API made up of AWS Lambda functions. For the API, we have three environments (prod, staging, and demo). We were developing the functions using serverless-offline and the functions look like this (there are 84 functions in total, 28 functions in each env.):

Production

  • api-prod-function-1
  • api-prod-function-2
  • api-prod-function-3
  • etc...

Staging

  • api-staging-function-1
  • api-staging-function-2
  • api-staging-function-3
  • etc...

Demo

  • api-demo-function-1
  • api-demo-function-2
  • api-demo-function-3
  • etc...

According to the environment, the functions are connected to different DBs and different ENVs of the services that we use (i.e - Auth0 sandbox and live, Mailgun sandbox and live, etc.)

The problem is that the functions have exceeded the max code storage limit of 75GB. We used this script to clean up the old versions, but it seems like there are no older versions left to delete.

So my questions are:

  1. Is it possible to increase this storage limit?
  2. Basically, the whole API is built on lambda functions and each endpoint calls its own lambda function. Is this a good use case of Lambda?

Packages used:

  • analytics-node
  • auth0
  • aws-sdk
  • eversign
  • formidable
  • jsonwebtoken
  • knex
  • lambda-multipart-parser
  • lambda-slack-router
  • middy
  • moment
  • nodemailer
  • nodemailer-mailgun-transport
  • objection
  • pg
  • raven
  • request
  • request-promise-native
  • serverless-sentry
  • serverless-sentry-lib
  • sha1
  • slack-notify
  • uuid
  • validator

FYI: The person who built all this in the first place has left the company, and I'm the one who has to look after it until we find a suitable person. I have a little experience in AWS so any advice would be a big help.

Thanks in advance.

2 Answers2

2

Is it possible to increase this storage limit?

Yes, you can request more storage for Lambdas. Go to the Support Center --> Select Create Case --> Select Service Limit Increase --> Limit Type Lambda

enter image description here

Scroll down to the Requests section and fill it in for Function and Layer Storage as seen in the image below. Fill in your Use Case and submit.

enter image description here

Basically, the whole API is built on lambda functions and each endpoint calls its own lambda function. Is this a good use case of Lambda?

Generally speaking, yes this is a very good use case for Lambdas. The caveat being I don't know your architecture or code. There are several references (listed below) on uses cases for Lambdas and how to create REST API's using Lambda.

Websites – Suppose you are creating a website and you want to host the backend logic on Lambda. You can invoke your Lambda function over HTTP using Amazon API Gateway as the HTTP endpoint. Now, your web client can invoke the API, and then API Gateway can route the request to Lambda.

References

Create REST API with Lambda Integrations in Amazon API Gateway
Create a Simple Microservice using Lambda and API Gateway
Common Lambda Application Types and Use Cases

kenlukas
  • 3,101
  • 2
  • 16
  • 26
0

Are you using serverless to deploy your API and Lambda functions? That's the easiest way to make sure they're provisioned to the correct endpoint since you can assign the endpoints to each Lambda inline.

https://carova.io/snippets/serverless-aws-api-gateway-create-and-deploy-api

Then you'd add a Lambda function like in here: https://carova.io/snippets/serverless-aws-lambda-function-as-api-gateway-endpoint