Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk7 min

How to Take Bulk Website Screenshots with Playwright on an Indian AWS EC2 Instance

Run a bounded Playwright screenshot batch on an AWS EC2 instance in Mumbai, with Node.js setup, full-page capture code, security guidance, and fixes for common failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture many websites with Playwright from India, launch a Linux EC2 instance in AWS Asia Pacific (Mumbai), region ap-south-1, install Node.js and the matching Playwright browser dependencies, then process URLs through a bounded queue. Use page.screenshot({ fullPage: true }) when you need the full scrollable page. The guide below includes a runnable Node.js pattern, safe operating practices, and common failure fixes.

Choose the Mumbai region and an instance

In the AWS console, choose the Asia Pacific (Mumbai) region, whose region code is ap-south-1. Confirm current instance-family availability in AWS’s regional instance availability table when launching; available types change, and the right size depends on your pages, deadline, and concurrency.

As an Amazon Associate I earn from qualifying purchases.

Begin with a modest instance and a low worker limit. Measure CPU, memory, timeouts, and successful captures on representative URLs before increasing either. There is no defensible universal pages-per-minute figure: results depend on the site set, browser version, viewport, and instance type.

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

Install Node.js, Playwright, and its browser

On a Linux AMI, install a supported Node.js runtime, initialize a project, add Playwright, then install the browser binary and Linux dependencies with Playwright’s install flow. Pin the Playwright package version and install the browser build that corresponds to that version on the instance. Avoid copying a browser cache from a different operating system.

#1 Best Overall
npm init -y
npm install playwright
npx playwright install --with-deps chromium

Check Playwright’s browser installation documentation for current options. A workload that only needs Chromium’s headless shell may use the documented --only-shell option. Choose the browser mode and channel deliberately if you need a different supported browser or rendering behavior. Browser downloads consume hundreds of megabytes, depending on browser, so allow disk space for the browser and your output files.

Capture a batch with a bounded queue

Save this as capture.js. It accepts URLs as command-line arguments, writes one full-page PNG per URL, uses a separate browser context for each job, and runs no more than the chosen number of workers at once.

const { chromium } = require('playwright');
const fs = require('node:fs/promises');
const path = require('node:path');
const crypto = require('node:crypto');

function safeHost(url) {
  try {
    return new URL(url).hostname.replace(/[^a-zA-Z0-9.-]/g, '_') || 'page';
  } catch {
    return 'invalid-url';
  }
}

async function capture(urls, outputDir, concurrency = 2) {
  if (!Number.isInteger(concurrency) || concurrency < 1) {
    throw new Error('concurrency must be a positive integer');
  }
  await fs.mkdir(outputDir, { recursive: true });
  const browser = await chromium.launch({ headless: true });
  const results = new Array(urls.length);
  let next = 0;

  async function worker() {
    while (true) {
      const index = next++;
      if (index >= urls.length) return;
      const url = urls[index];
      const id = crypto.createHash('sha256').update(url).digest('hex').slice(0, 12);
      const file = path.join(outputDir, `${String(index).padStart(4, '0')}-${safeHost(url)}-${id}.png`);
      const startedAt = new Date().toISOString();
      let context;
      try {
        const parsed = new URL(url);
        if (!['http:', 'https:'].includes(parsed.protocol)) {
          throw new Error('Only http and https URLs are allowed');
        }
        context = await browser.newContext({ viewport: { width: 1440, height: 900 } });
        const page = await context.newPage();
        await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 45_000 });
        await page.screenshot({ path: file, fullPage: true });
        results[index] = { url, status: 'ok', file, startedAt };
      } catch (error) {
        results[index] = { url, status: 'error', error: error.message, startedAt };
        console.error(`Capture failed for ${url}: ${error.message}`);
      } finally {
        if (context) await context.close().catch(() => {});
      }
    }
  }

  try {
    await Promise.all(Array.from({ length: Math.min(concurrency, urls.length) }, worker));
  } finally {
    await browser.close();
    await fs.writeFile(path.join(outputDir, 'manifest.json'), JSON.stringify(results, null, 2));
  }
}

const urls = process.argv.slice(2);
if (urls.length === 0) {
  console.error('Usage: node capture.js https://example.com [https://example.org ...]');
  process.exitCode = 2;
} else {
  capture(urls, 'screenshots', 2).catch(error => {
    console.error(error);
    process.exitCode = 1;
  });
}

Run it with:

node capture.js https://example.com https://example.org

The concurrency value of two and 45-second navigation timeout are starting parameters in this example, not performance guarantees. Increase concurrency gradually only after checking resource use and target-site behavior. The manifest records each URL’s outcome; the index, sanitized hostname, and URL hash make filenames more stable and reduce collision risk.

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

Choose the right capture extent and completion condition

By default, a screenshot covers the viewport. Set fullPage: true to capture the full scrollable page; omit it for viewport-only output. The sample waits for domcontentloaded, which is a deliberate baseline rather than proof that every image or dynamic component has finished loading. Some pages lazy-load content only after scrolling, while network-idle can be unreliable on sites with persistent requests. For a known page, add an explicit wait for a selector or a measured delay only when required.

Choose browser context isolation

A new context for each URL keeps cookies and storage separate, which is useful when pages should not share identity or session state. If a batch intentionally uses the same authenticated session, use a shared context and multiple pages instead, while accounting for shared cookies and storage. Playwright’s context and page lifecycle options are documented in the Browser API and BrowserContext API.

Rank #2
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
  • 256 GB SSD of storage.
  • Multitasking is easy with 16GB of RAM
  • Equipped with a blazing fast Core i5 2.00 GHz processor.

Control throughput, output, and security

Keep concurrency bounded

Each open page uses browser and system resources, and aggressive request volume can trigger rate limits or blocks. For a custom script, implement a queue or semaphore as above; Playwright Test’s --workers limit applies to its own worker processes, not arbitrary Node.js scripts. Its workers each start a browser, so do not assume that setting controls this batch script.

Store artifacts and status

Keep output on a filesystem with enough room, organize separate runs into separate directories, and upload completed files to an approved object-storage destination if durable retention is needed. Check the manifest and expected output files before treating a batch as complete. Storage tier and cost depend on your retention and access needs.

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

Protect the instance and network

Treat input URLs as untrusted: an arbitrary URL can point at internal services or sensitive network destinations. Validate the input source and avoid allowing user-supplied URLs to reach sensitive addresses. Do not bypass access controls; some sites require authentication or block automation, and content can vary by location. Use a dedicated instance and a least-privilege role. Restrict SSH ingress to trusted source addresses. AWS warns in its security group guide: “When configuring a source for a rule that allows SSH or RDP access to your instances, do not allow access from anywhere, because it would allow this access to your instance from all IP addresses on the internet.” Shut down the instance and other billed resources when the job is complete.

Keep screenshots comparable and reliable

Rendered output can vary with host OS, browser version, browser settings, hardware, and headless mode. For comparisons across runs, keep the operating system image, Playwright package and browser build, viewport, and context settings consistent. Record those settings alongside the batch manifest when reproducibility matters.

Production runs should also validate input URLs, sanitize output paths, keep a durable per-URL status record, and retry transient failures only with a cap. A browser crash should not silently mark unfinished URLs successful; record failure and rerun failed entries deliberately. For a larger workload, decide whether one browser process per batch or a managed pool better fits your recovery and resource requirements, then measure it with your actual URL mix.

Rank #3
15.6 Inch Win 11 Laptop Computer, N4020, 4GB DDR4 RAM, 128GB Storage | LPDDR4 RAM, 180° Lay-Flat, Dual-Band WiFi, Type-C PD Fast Charging, Thin & Lightweight for Students, Home & Office, Gray
  • WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
  • 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
  • 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
  • CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
  • LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

  • Browser launch fails or reports missing libraries: install the browser and Linux dependencies through the Playwright install flow for the installed package, then verify the Playwright package and downloaded browser versions match.
  • Navigation times out: the host may be slow, unreachable, or waiting on persistent activity. Check the URL and network path, choose an explicit completion condition appropriate to the page, and adjust the timeout based on observed site behavior.
  • Screenshot is blank or incomplete: confirm the page navigated successfully and that the chosen wait condition matches the content. For lazy-loaded pages, wait for the relevant selector or scroll through the page before capturing; fullPage controls extent, not whether dynamic content has rendered.
  • Some sites show a bot check or different content: sites may block automation or serve region-specific content. Do not attempt to bypass access controls; review the site’s permitted access method and record the outcome as a failed or blocked capture.
  • Instance becomes slow or workers fail: lower concurrency, inspect CPU and memory, and test a representative subset before scaling up. More workers can increase pressure on the instance and on target websites.
  • Files overwrite each other or paths fail: use collision-resistant names and ensure output paths are created from sanitized values, not raw URLs.
  • SSH access is exposed: update the security group so SSH is allowed only from trusted source addresses, rather than from all IP addresses.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF, so a batch client can call the endpoint for each URL instead of installing and maintaining Chromium on EC2. See the ScreenshotNeo API documentation for request options.

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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

Cookie banners are accepted like a visitor and more than 60 known consent platforms, newsletter popups, and chat widgets are removed before capture; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots, and every feature is available on every plan.

Sign up free for 1,000 screenshots a month, with no card required.

Frequently Asked Questions

Does this guide require an EC2 instance physically located in Mumbai?

No. It specifies AWS’s Mumbai region, ap-south-1, for the workload; actual instance-family availability is subject to AWS’s current regional offering.

Can I use the same script for viewport screenshots?

Yes. Remove fullPage: true from the screenshot call to capture the viewport instead of the full scrollable page.

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

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 *

Free tools Windows power users keep installed

One-click scans. No signup required.

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
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.