This AWS CDK construct provides a simple way to create a screenshot of a URL using Chromium and Playwright on AWS Lambda. With this construct, you can easily integrate screenshotting functionality into your AWS-based applications.
- AWS CDK version 2.x
- Node.js 14.x or higher
- AWS account with necessary permissions
- In your AWS CDK project, import the
PlaywrightScreenshot
construct:
import { ScreenshotLib } from '@chromium-for-lambda/playwright-screenshot';
- Create a new instance of the
ScreenshotLib
construct:
const screenshotConstruct = new ScreenshotLib(this, 'ScreenshotLib');
- Synthesize the construct to create the necessary AWS resources:
cdk synth
- Deploy the construct to AWS:
cdk deploy
Once the construct is deployed, you can call the Lambda function to create a screenshot of a URL. To do this, use the ?url=
query parameter to specify the URL you want to screenshot:
https://your-lambda-function-url.com/?url=https://example.com
The Lambda function will create a screenshot of the specified URL and store it in the specified screenshot bucket.
If you encounter any issues with the construct, please check the AWS CloudWatch logs for errors. You can also reach out to the maintainers of this construct for assistance.
This construct is licensed under the MIT license.