Skip to content

An example online screenshot application using AWS Lambda Layers on the Serverless Framework

License

Notifications You must be signed in to change notification settings

kumarbhushan/serverless-lambda-layers

Repository files navigation

serverless-lambda-layers

Introduction

An example online screenshot application using AWS Lambda Layers on the Serverless Framework which is the base for the following blog post

The application uses chrome-aws-lambda as a lambda layer when deployed to the cloud which allows us to use Chromium and Puppeteer to open the desired webpage within a lambda in a headless browser, generate the screenshot, and store it in S3 (returning the download path in the API response)

serverless-layers-architecture

Installation

In the root folder install the dependencies using the command npm i (Node version v12.14.0).

Running Local

The application has been setup so you can run this locally without the need to deploy to AWS using the following command:

npm run offline

This will spin up the API locally using the serverless-offline plugin, and the generated screenshots are stored in a local S3 emulator using the serverless-s3-local plugin.

There is a Postman collection in the folder ./postman which can be imported and used (for both local and deployed versions)

Deploying to AWS

To deploy to AWS run the following command npm run deploy:devlop which will deploy the solution to the cloud. You can then use the Postman file to hit the endpoint with the correct payload.

Removing from AWS

To remove the full application from the cloud run the command npm run remove:develop

About

An example online screenshot application using AWS Lambda Layers on the Serverless Framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript63.4%
  • JavaScript36.6%