

In a terminal, check out the code used in this article and install it. Review the CDK installation instructions.ĭownload and install the dependencies and example CDK application # Install, build and test the Puppeteer app and ChromeĪWS CDK must be installed. # Install Chrome to get all of the dependencies installedĮNV AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \ĪWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \ĬOPY package*.json tsconfig.json $/test/ # Allow AWS credentials to be supplied when building this container locally for testing, # Start with an AWS provided image that is ready to use with Lambda Here is a documented version of the Dockerfile that is used to create a container for use with Lambda. Lambda container Dockerfile for Puppeteer function

In this example, multiple instances of Puppeteer will simultaneously take screenshots of several popular news websites and store them in Amazon S3. This blog will show how to run Puppeteer and Chrome in a Lambda container function. With Lambda, Node packages can be installed in a container instead of having to put them in Lambda layers. When using Puppeteer in Lambda with container image support, you can scale browser automation horizontally.

Puppeteer is a Node library which allows you to automate tasks in headless Chrome. Puppeteer can now be packaged as a container image in a Lambda function to perform browser automation or any web scraping functionality. How would you go about doing that? Try a headless browser automation tool like Puppeteer. You would like to test 100K simultaneous connections to the website and make sure it is working properly. You are expecting a huge amount of traffic due to the seasonality of the product. Imagine you are launching a brand new website selling goods and services. This post is contributed by Bill Kerr, SHI and Raj Seshadri, Global SA Lead, AWS.
