DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk7 min

How to Generate Website Screenshots in an AWS Lambda Function

A practical guide to packaging a headless browser in AWS Lambda, capturing pages, storing screenshots in S3, and handling configuration and reliability.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture a website in AWS Lambda, package a headless browser with your function, launch it to render the page, write the image to Lambda’s temporary /tmp directory, and upload it to durable storage such as Amazon S3. AWS’s example uses Puppeteer and headless Chrome in a Lambda container image; the right package format and resource settings depend on your workload.

How the screenshot workflow fits together

  1. Package a browser. A Lambda function needs both browser automation code and a compatible headless browser binary, plus the dependencies required to launch it.
  2. Render the page. The function opens the target URL and waits for the page to reach the condition you need before taking the screenshot.
  3. Write a temporary file. Save the image under /tmp, the writable part of the function filesystem.
  4. Persist the result. Upload the image to S3 or another durable destination. A file left only in /tmp is not durable application output.

AWS’s published screenshot example follows this pattern with Puppeteer, headless Chrome, a Lambda container image, and S3. AWS’s serverless Puppeteer example

Choose a Lambda package format

Container image

A container image is a practical choice when you need control over browser binaries and native dependencies. AWS’s example packages Puppeteer and headless Chrome this way. Lambda supports container images up to 10 GB uncompressed, including layers. AWS Lambda container image documentation

Use an AWS Lambda base image or another compatible image that includes the required runtime interface client. The larger and more complicated the browser stack, the more important it is to keep the image build reproducible and verify that its browser can launch in the target Lambda environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0

ZIP deployment package

Lambda also supports ZIP deployment packages. A ZIP can work when the browser binary and all required libraries fit your packaging and deployment approach, but browser dependencies can make packaging and maintenance less convenient than using a container. AWS documents both package types and the available function configuration settings. AWS Lambda ZIP deployment package documentation

Neither format is a universal winner. Choose based on how you build, deploy, and update the browser, and test the complete artifact rather than assuming a package that works on a developer machine will work in Lambda.

Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)

Build the screenshot worker

The code below illustrates the worker’s core steps: launch Puppeteer, capture a page to /tmp, and upload the file to S3. It assumes that Puppeteer and a compatible Chrome or Chromium binary are included in the deployed artifact, and that the function’s execution role can write to the selected bucket. Browser executable paths and launch arguments vary with the browser build; set them to match the artifact you actually package.

const puppeteer = require('puppeteer-core');
const { S3Client, PutObjectCommand } = require('@aws-sdk/client-s3');
const fs = require('node:fs/promises');
const path = require('node:path');

const s3 = new S3Client({});
const bucket = process.env.SCREENSHOT_BUCKET;
const chromePath = process.env.CHROME_EXECUTABLE_PATH;

exports.handler = async (event) => {
  if (!bucket) throw new Error('Set SCREENSHOT_BUCKET');
  if (!chromePath) throw new Error('Set CHROME_EXECUTABLE_PATH');

  const url = event.url;
  if (typeof url !== 'string' || url.length === 0) {
    throw new Error('Provide a URL string in event.url');
  }

  // Production functions should validate and restrict target URLs.
  const browser = await puppeteer.launch({
    executablePath: chromePath,
    headless: true,
    args: ['--no-sandbox', '--disable-setuid-sandbox']
  });

  const outputPath = path.join('/tmp', `screenshot-${Date.now()}.png`);
  try {
    const page = await browser.newPage();
    await page.goto(url, { waitUntil: 'networkidle2', timeout: 60000 });
    await page.screenshot({ path: outputPath, fullPage: true, type: 'png' });

    const body = await fs.readFile(outputPath);
    const key = `screenshots/${Date.now()}.png`;
    await s3.send(new PutObjectCommand({
      Bucket: bucket,
      Key: key,
      Body: body,
      ContentType: 'image/png'
    }));

    return { bucket, key, contentType: 'image/png' };
  } finally {
    await browser.close();
    await fs.rm(outputPath, { force: true });
  }
};

This is a worker pattern, not a complete deployable project: the browser executable, its native libraries, the Lambda runtime, deployment artifact, and S3 permissions must all be configured for your chosen build. The networkidle2 wait condition is an example, not a guarantee that every page has finished rendering; some sites keep network connections open or load content later. Choose a wait strategy that matches the pages you capture.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
  • STAY ORGANIZED – Easily convert your paper documents into digital formats like searchable PDF files, JPEGs, and more.Power Consumption : 2.5W or less (Energy Saving Mode: 0.7W). Suggested Daily Volume : 500 scans..Does it contain liquid: no
  • CONVENIENT AND PORTABLE –lightweight and small in size, you can take the scanner anywhere from home offices, classrooms, remote offices, and anywhere in between
  • HANDLES VARIOUS MEDIA TYPES – Digitize receipts, business cards, plastic or embossed cards, reports, legal documents, and more
  • FAST AND EFFICIENT – No technical hurdles or complicated setups here; easily scan both sides of a document at the same time, in color or black-and-white, at up to 12 pages-per-minute, and with a 20 sheet automatic feeder
  • BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer

Give temporary storage and durable output deliberate settings

Lambda’s function filesystem is read-only except for /tmp. AWS documents configurable /tmp storage from 512 MB through 10,240 MB, in 1 MB increments. Browser extraction, browser caches, and temporary image files all consume writable space, so size it for the artifacts and concurrent work your function actually performs. AWS Lambda container image documentation

Upload completed screenshots to S3 or another durable storage system before the invocation ends. Treat /tmp as scratch space, not as the storage location for results another process must retrieve later. AWS’s example uploads screenshots to S3. AWS’s serverless Puppeteer example

Rank #4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
  • IRIScan Express, portable scanner : scans color and black and white documents a blazing speed up to 8ppm simplex. Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • IRIScan Express mobile scanner is powered via an included micro USB 2. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan. USB cable provided. AC Adapter not provided and not needed.
  • IRIScan flatbed scanner uses a simplex scanning mode allows for quick and straightforward scanning of single-sided documents. IRIScan with its full portable features is the ideal document scanners for computers.
  • IRIScan document scanner : Versatile scanning capabilities, including scanning to Word, PDF, and Excel formats with companion software provided Readiris OCR
  • Receipt scanner and card scanner with Additional features include scanning business cards directly to Outlook, photo scanning, and receipt scanning for efficient document management

Configure for the pages you capture

Lambda exposes settings for memory, timeout, ephemeral storage, networking, and file-system configuration. There is no evidence-supported universal memory size, timeout, or storage allocation for screenshot work: pages differ in scripts, load behavior, dimensions, and output size. Start with representative pages, observe failures and resource use, and adjust the settings against your own workload. AWS Lambda function configuration documentation

  • Memory and timeout: Allow enough time for browser startup, navigation, rendering, image encoding, and the S3 upload. Set limits based on observed page behavior rather than an assumed standard.
  • Ephemeral storage: Leave room for the browser, its caches, and the largest expected temporary screenshot files.
  • Networking: Confirm that the function can reach the target sites and S3 under your VPC and security configuration.
  • Output dimensions: Full-page screenshots and large viewports can produce much larger images than a small viewport capture.

No fixed latency, throughput, or per-screenshot cost follows from the package choice alone. Cold starts, runtime and architecture, browser build, region, page behavior, memory, and output size all affect results; measure using the conditions you plan to run in production.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Capture a batch of URLs with asynchronous fan-out

For a list of URLs, AWS’s example separates orchestration from rendering: a fan-out function accepts the list and asynchronously invokes a screenshot worker for each URL. This avoids making one invocation responsible for every browser session, but it also means you need to track individual outcomes and decide how to handle retries and partial completion. AWS’s serverless Puppeteer example

  • Use a single worker invocation when one request represents one capture and its result can be returned directly.
  • Use asynchronous fan-out when the caller submits multiple URLs and can collect results separately.
  • Define failure handling, concurrency limits, retry behavior, and result tracking for your application; the example pattern does not promise a specific completion time or throughput.

Choose and maintain the browser automation library carefully

AWS’s screenshot example uses Puppeteer. Playwright documents screenshot-based visual comparison features, but that is not evidence of a particular current Lambda deployment configuration. Select a library based on the API you need and verify that its current browser binaries and dependencies run in the Lambda runtime and architecture you deploy.

Do not rely on an old compatibility list from a third-party package as proof of current support. For example, the npm documentation for playwright-aws-lambda describes Chromium and older Node runtimes, but package documentation can become stale. playwright-aws-lambda on npm Test the exact versions and deployed artifact you intend to operate. Playwright screenshot comparison documentation

Secure URL input before launching a browser

A screenshot worker that accepts arbitrary URLs can be exposed to unsafe targets, including private network resources. The AWS example demonstrates URL capture but does not establish a complete defense for untrusted input, authorization, or private-network access. Before accepting caller-supplied URLs, define an allowlist or equivalent restrictions and consult current AWS security guidance for your deployment. Do not assume that browser automation by itself makes arbitrary URL fetching safe.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot common failures

Browser fails to launch

  • Likely cause: The executable path is wrong, the browser binary is missing from the artifact, or a native dependency is unavailable in the Lambda environment.
  • Fix: Check the deployed artifact and configured executable path; build against a compatible Lambda environment and test the browser launch from that artifact.

Screenshot works locally but not in Lambda

  • Likely cause: The local machine provides browser dependencies or writable paths that are absent in Lambda.
  • Fix: Package the browser and dependencies with the function, write temporary files under /tmp, and validate the deployed package format and runtime.

Navigation times out or the capture is incomplete

  • Likely cause: The page loads slowly, keeps network activity alive, or renders important content after the chosen navigation condition.
  • Fix: Set a timeout appropriate to measured page behavior and choose a wait condition that reflects when the content you need is ready. Avoid treating network idle as proof that every page is visually complete.

Temporary file cannot be written or storage fills up

  • Likely cause: The code writes outside the writable temporary directory, or browser files and screenshots exceed the configured ephemeral storage.
  • Fix: Use /tmp, remove temporary output when finished, and increase ephemeral storage if the workload requires it.

Upload fails

  • Likely cause: The function cannot reach S3 or its execution role lacks permission for the destination bucket and key.
  • Fix: Check connectivity and the function’s access policy for the intended write operation and bucket.

Batch results are missing or arrive later than expected

  • Likely cause: Asynchronous workers can fail independently, and the fan-out pattern does not provide a guaranteed completion time.
  • Fix: Track each submitted URL and its outcome, define retries and concurrency controls, and make partial failures visible to the caller.

Or skip the browser setup

If you need screenshot capture without packaging and maintaining a browser in Lambda, ScreenshotNeo provides a website screenshot API and MCP server. Its one-call API can return a screenshot in PNG, JPEG, or WebP, or a PDF. The API options include full-page capture, element selection, custom viewport and device settings, PDF controls, custom CSS and JavaScript, wait conditions, request blocking, caching, and asynchronous jobs; see the ScreenshotNeo documentation for request details.

Quick Recap

SaleBestseller No. 3
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer; This product is not intended for scanning photographs on photo paper / photographic media
$153.00
Bestseller No. 4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
Find our Software here : irislink.com/start; IRIScan Express is only compatible Windows platform and not macintosh
$129.00
Bestseller No. 5
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.00
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.