Best way to use AWS Lambda with S3 (thumbnail creator)

What is AWS Lambda?

AWS Lambda is a serverless computing service that lets developers work on the coding needed for their application without having to set up or manage any servers.

Amazon Web Services (AWS) Lambda is a cloud computing service with which developers can run code without provisioning or managing servers.

Lambda offers compute power in the form of concurrency, where developers can run their code concurrently across multiple nodes- this means that the workload of their application will be divided between these nodes.

What is AWS S3 ?

The Amazon Web Services (AWS) Simple Storage Service (S3) is a web service provided by Amazon.com.

The Simple Storage Service is designed to store large amounts of unstructured data, such as text or binary files, and provide a variety of ways to store and retrieve them. It does not limit the size of data that can be stored. Unstructured data is typically stored in raw format, but can also be converted into other formats such as XML or JSON before storage.

A “bucket” in the S3 service is a logical container for storing and retrieving objects over the Internet using HTTP protocols. This metadata includes information like: bucket name, security credentials, storage class (e.g., REDUCED_REDUNDANCY or STANDARD),

How does AWS Lambda work with S3?

Amazon Web Services Lambda is a serverless computing service that provides a function as a service model. In simple words, it is a computing service for developers. AWS Lambda lets developers upload their code to the cloud and have it run automatically on demand.

The AWS Lambda can work with Amazon Simple Storage Service (S3). AWS Lambda lets you build your own serverless applications that use features of S3 such as object storage, bucket policies, and encryption by transferring data from S3 to AWS Lambda environment and back on demand.

Tell me about AWS Api gateway?

The AWS API Gateway defines a proxy layer between the back-end AWS Lambda functions and the clients accessing them. The proxy is an HTTP server capable of routing requests to Lambda functions.

The API Gateway can be used to create a single, unified RESTful interface for invoking the code running on the AWS Lambda infrastructure. You can also use it as a trigger for the Lambda function.

For example, if you have a new kind of endpoint that is not supported by your Lambda function, you can simply add it to the API and it will be automatically supported in all future invocations

 

What is the s3 bucket use cases ?

The s3 bucket is an excellent storage solution which can be used to store data. It's reliable and secure, and it's easy to maintain.

It's also scalable, meaning that you can expand your storage space as your business grows. You can also use it for backup services; you can keep copies of your data in case anything ever happens to the original files.

 

How to create an AWS S3 bucket?

The best way to create an S3 Bucket is via the AWS Console. It is as easy as 1-2-3:

1. Go to the AWS Console and click on S3 in the main navigation bar

2. Click on create bucket

3. Fill in a name for your bucket and click Create

 

How can we use the AWS Lambda trigger ?

AWS Lambda triggers are one of the ways to automate Lambda functions. Triggers are requests to start, stop, or perform specific actions on your AWS resources. For example, you could configure your function to automatically start when an object is added to S3 bucket, or send messages on behalf of SES recipients.

Lambda state triggers are used to start and stop functions based on the state of another service. They’re particularly useful for triggering functions when other AWS resources change state, for instance for scaling down EC2 instances in response to an alarm threshold being reached or scaling back up if it falls below that threshold.

With an S3 trigger, we can easily react on S3 storage events, for example: we can create a thumbnail for the uploaded image automatically.

 

What is a picture thumbnail ?

A thumbnail is an image that is usually smaller than the original image.

 

In the next tutorial i will show the exact code, for the thumbnail creator.