To capture a web page in AWS Lambda, package a headless browser with your function, launch it to navigate to the target URL, save the screenshot in writable /tmp, then upload it to durable storage such as Amazon S3. AWS’s example uses Puppeteer and headless Chrome in a Lambda container image; Lambda also supports ZIP packages, but browser dependencies can make a container easier to control.
How the Lambda screenshot flow works
A screenshot function runs browser automation much like a local script, with serverless-specific packaging and storage constraints. The function must have a compatible browser binary and its dependencies, enough time and memory to render the page, a writable place for temporary files, and a destination for output that must persist after the invocation.
- Package Puppeteer and headless Chrome, or another browser automation stack whose current runtime compatibility you have verified.
- Start the browser and navigate to the requested page.
- Capture the page or a selected element and write the resulting image to
/tmp. - Upload the image to S3 or another durable destination before the function returns.
A file left only in Lambda’s temporary storage is not durable application output. AWS’s screenshot example uses S3 for persistence and a separate asynchronous fan-out function to dispatch batches of URLs to screenshot workers. AWS’s serverless website screenshot example.
Choose a deployment package
Container image
A container image lets you control the browser binary, native libraries, and runtime dependencies together. AWS’s example takes this route for Puppeteer and headless Chrome. Lambda supports container images up to 10 GB uncompressed, including layers. You must use an AWS Lambda base image or a compatible alternative that includes the required runtime interface client. See AWS Lambda container images.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
ZIP deployment package
Lambda also supports ZIP deployment packages. A ZIP can work if the browser and native dependencies fit your packaging and deployment approach, but browser binaries can make dependency management more involved. Select based on the browser build, runtime, architecture, deployment process, and package maintenance you can support. AWS describes both ZIP archives and container images in its Lambda deployment package documentation.
Puppeteer or Playwright
AWS’s Lambda screenshot example uses Puppeteer. Playwright documents screenshot capture and visual comparison features, but those features alone do not establish that a particular Playwright/browser/runtime combination is ready for Lambda. Before choosing either library, verify its current supported Node.js version, browser build, operating-system libraries, and Lambda architecture. The third-party playwright-aws-lambda package page may describe older runtime support; do not treat its runtime list as current compatibility guidance. Playwright’s visual comparison documentation covers screenshot functionality, not Lambda deployment compatibility.
Configure writable storage and function resources
Lambda’s function filesystem is read-only apart from /tmp. AWS documents configurable /tmp storage from 512 MB to 10,240 MB, in 1 MB increments. Browser extraction, caches, and screenshot files all need space there. Configure the amount for the browser package and workload rather than assuming the default will be sufficient. AWS Lambda container images.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Lambda configuration also exposes memory, timeout, ephemeral storage, networking, and file-system settings. A page with heavy scripts, large images, or delayed content can need different settings from a simple static page. There is no universal memory, timeout, latency, or cost figure established for screenshot workloads: measure with representative pages, image dimensions, browser builds, architecture, and region before setting production limits. See Lambda function configuration.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesImplement the screenshot worker
The following is the worker’s core logic, not a complete deployable project: it assumes your deployment packages a compatible Puppeteer/browser build and that the execution role can write the output object to S3. Adapt the browser launch configuration to the browser package you select; there is no single launch configuration valid for every Lambda browser build.
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({});
exports.handler = async (event) => {
const url = event.url;
const bucket = process.env.SCREENSHOT_BUCKET;
const key = event.key || `screenshots/${Date.now()}.png`;
const file = path.join('/tmp', `${Date.now()}.png`);
if (!url || !bucket) {
throw new Error('Provide event.url and set SCREENSHOT_BUCKET');
}
// Configure executablePath and launch arguments for the browser build
// packaged with this function.
const browser = await puppeteer.launch({
executablePath: process.env.CHROMIUM_PATH,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
headless: true
});
try {
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle2', timeout: 30000 });
await page.screenshot({ path: file, fullPage: true, type: 'png' });
const body = await fs.readFile(file);
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.unlink(file).catch(() => {});
}
};
Package the S3 client and browser automation library with the function, provide the browser executable at the configured path, and set SCREENSHOT_BUCKET. Grant the function’s execution role permission to put objects in the intended bucket. Choose a page readiness condition that matches your targets: waiting for network idle can time out on pages with persistent connections, while capturing immediately after navigation can miss content rendered later. A selector wait or a bounded delay may fit some pages better.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
The example accepts a URL from the event. If callers can control that value, define URL allowlisting or equivalent controls and review current AWS security guidance before exposing the function. The example pattern does not establish a complete defense against private-network access or unauthorized capture.
Handle multiple URLs without blocking one invocation
For a small single request, one worker invocation can capture one page. For a list of URLs, AWS’s example separates orchestration from rendering: a fan-out function receives the list and asynchronously invokes a screenshot worker for each URL. This keeps the worker focused on one capture and avoids treating one long-running invocation as an entire batch.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →In a production batch workflow, decide how to track each URL’s result, retry transient failures, constrain concurrency, and report partial completion. AWS’s example demonstrates asynchronous fan-out; it does not promise a particular completion time or throughput.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Troubleshoot common failures
- Browser executable not found: The configured path does not match the packaged browser. Check the deployed artifact and environment variable, then verify that the binary is executable in the Lambda runtime.
- Browser fails to start because of missing libraries: The image or ZIP is missing native dependencies or targets an incompatible runtime or architecture. Build and validate against the intended Lambda environment, and package the required libraries with the browser.
- Permission or read-only filesystem error: The function tried to extract the browser or write an image outside
/tmp. Direct temporary files and browser caches to writable temporary storage. - Storage fills up: Browser extraction, caches, and screenshots exceed configured ephemeral storage. Increase
/tmpcapacity within Lambda’s documented range or remove temporary files and unnecessary cache data. - Navigation times out: The target may be slow, blocked, or never reach the chosen readiness condition. Review network access, the page’s behavior, and the readiness strategy; adjust the timeout to the workload and Lambda’s configured timeout rather than assuming a fixed value.
- Screenshot is blank or incomplete: The page may need more rendering time or a specific element to appear. Wait for a relevant selector or use a bounded delay, and inspect the page response and browser logs.
- Screenshot succeeds but output disappears: The file was written only to temporary storage. Upload it to S3 or another durable destination before returning.
- Some batch URLs fail: Treat each asynchronous worker result independently, record failures, and define retries and concurrency limits in the orchestration layer.
Performance, reliability, and cost decisions
Cold starts, capture time, throughput, and per-screenshot cost vary with the runtime version, browser build, page behavior, memory setting, architecture, region, and image size. No universal benchmark or cost per capture is established here. Test representative pages under the configuration you intend to deploy, including slow and script-heavy pages, and use those observations to choose memory, timeout, temporary storage, and concurrency settings.
Browser packaging also creates a maintenance responsibility: keep the browser binary, automation library, and runtime combination compatible as you update them. A successful local run does not by itself confirm that the same dependencies will launch in the deployed Lambda environment.
Or skip the browser setup
If you need screenshots without packaging and maintaining Chromium in Lambda, ScreenshotNeo provides a screenshot API and MCP server. One GET request returns an image or PDF; the example below saves a screenshot response to a file:
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for parameters and response details. Cookie banners are accepted and removed before capture, along with supported newsletter popups and chat widgets; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents use screenshot tools. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo’s free plan.
Frequently Asked Questions
Can Lambda retain a screenshot file after an invocation ends?
Not as durable output in /tmp; upload the image to persistent storage such as S3 before the function returns.
Does AWS’s example prove a particular screenshot latency or per-image cost?
No. Those figures depend on the browser, page, configuration, region, and output, so measure your workload rather than relying on a universal estimate.
Quick Recap
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.

