Richmond Upon Thames, by Garret Keogh on Unsplash

Goal

In this post, I will show you how to use Amazon S3 Object Lambda to resize images on the fly. The Serverless Framework will be used to define the Infrastructure as Code and to simplify the deployment. Sharp will be used to resize the images. Lambda will be written using the Node.js 14x Lambda runtime

What’s Amazon S3 Object Lambda

One of the most common Lambda patterns is to transform data stored inside Amazon S3. Generally, a lambda function is invoked after a file has been uploaded. Lambda would retrieve that file, apply any needed transformation (e.g. …


Hi Shuvo, AWS Lambda works as follow:

1) When you invoke a lambda function the first time, AWS creates a container (cold start)

2) AWS executes your lambda inside the container

3) After the execution, AWS put the lambda in a pool for some time (about 15 min) to be resued

4) Next execution, AWS checks if there is any container available and uses that one (warm start)

You pay only for the time the lambda executes, not for the time the Lambda container is put in the pool and kept warm

What above is true for the normal AWS Lambda flow (e.g. using the Serverless Framework warmer lambda covered in the first part of the article)

That's different if you use Provisioned Concurrency as in that case you pay for the whole time the Lambda is available for you


Thanks Yusufbek! That is a naming convention that comes from the Serverless translation of the YAML file into a real resource.

If you see the the YAML file I created a "resizer" function

functions:

resizer:

handler: handler.resizer

environment:

BUCKET_NAME: ${self:custom.bucketName}

That function is translated into "ResizerLambdaFunction" from Serverless :)


Goals

In my previous tutorials, we started learning about the Serverless framework. In particular, in:

Today we are going…


Goals

In my previous tutorial “Serverless Framework: Deploy an HTTP endpoint using NodeJS, Lambda on AWS” we have learnt how to create an AWS Lambda HTTP endpoint implemented in NodeJS with Express using the Serverless framework.

Today we are going to learn how to:

  • Create and deploy a REST API with 2 endpoints (GET, POST) using Express, Serverless and AWS API Gateway
  • Provision a DynamoDB table using the Serverless syntax
  • Connect to the DynamoDB using the AWS SDK
The architecture we aim to implement

What’s DynamoDB?

Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. — docs.aws.amazon.com


Goals

Today you are going to learn how to create an AWS Lambda HTTP endpoint implemented in NodeJS with Express using the Serverless framework

Above the Architecture we aim to implement

What’s the Serverless Framework?

“ Serverless is your toolkit for deploying and operating serverless architectures. Focus on your application, not your infrastructure. — Serverless.com

Michele Riso

Cloud Architect, #AWS Certified Solutions #Architect & #DevOps Professional, RedHat #Openshift, MS #Azure linkedin.com/in/micheleriso

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store