{"id":17364707,"url":"https://github.com/tejasq/terraform-nodejs-screenshooter","last_synced_at":"2026-03-27T02:13:04.403Z","repository":{"id":82379669,"uuid":"337800608","full_name":"TejasQ/terraform-nodejs-screenshooter","owner":"TejasQ","description":"A thing I made for a talk to teach people about Terraform and Infrastructure as Code.","archived":false,"fork":false,"pushed_at":"2021-02-10T17:44:53.000Z","size":46,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T01:45:15.645Z","etag":null,"topics":["aws","aws-lambda","nodejs","terraform"],"latest_commit_sha":null,"homepage":"https://yjc4y405v8.execute-api.eu-central-1.amazonaws.com/prod?url=https://i.kym-cdn.com/entries/icons/original/000/013/564/doge.jpg","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TejasQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-02-10T17:31:18.000Z","updated_at":"2021-06-23T07:50:20.000Z","dependencies_parsed_at":"2023-03-02T08:15:53.412Z","dependency_job_id":null,"html_url":"https://github.com/TejasQ/terraform-nodejs-screenshooter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TejasQ/terraform-nodejs-screenshooter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TejasQ%2Fterraform-nodejs-screenshooter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TejasQ%2Fterraform-nodejs-screenshooter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TejasQ%2Fterraform-nodejs-screenshooter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TejasQ%2Fterraform-nodejs-screenshooter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TejasQ","download_url":"https://codeload.github.com/TejasQ/terraform-nodejs-screenshooter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TejasQ%2Fterraform-nodejs-screenshooter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31009651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T01:56:05.093Z","status":"online","status_checked_at":"2026-03-27T02:00:08.055Z","response_time":164,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-lambda","nodejs","terraform"],"created_at":"2024-10-15T20:43:24.118Z","updated_at":"2026-03-27T02:13:04.394Z","avatar_url":"https://github.com/TejasQ.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ScreenShooter\n\nThis project exists due to a talk I'm giving (or _gave_, depending on the time of writing) at [Node Congress](https://nodecongress.com/). The talk is about **Infrastructure as Code** (IaC) and features a Node.js application that is deployed to [Amazon Web Services](https://aws.amazon.com/) without ever leaving the editor.\n\n## What It Is\n\n![This repo](https://yjc4y405v8.execute-api.eu-central-1.amazonaws.com/prod?url=https://github.com/TejasQ/terraform-nodejs-screenshooter)\n\nThis tool is a simple [lambda function](https://stackoverflow.com/questions/16501/what-is-a-lambda-function#:~:text=A%20Lambda%20Function%20%2C%20or%20a,in%20C%20and%20Objective%2DC.) that takes a given `url` as _input_, and gives you a JPEG screenshot as _output_. It serves the image above, and can provide a 720p screenshot of any website of your preference at the following [URL](https://en.wikipedia.org/wiki/URL):\n\n`https://yjc4y405v8.execute-api.eu-central-1.amazonaws.com/prod?url={YOUR_URL_HERE}`\n\n## How It Works\n\nThis project uses [Terraform](https://www.terraform.io/) to declaratively describe the infrastructure we need. Terraform then makes this real by talking to AWS via its API and creating/modifying the resources we need. Terraform also has state management, so it can make cumulative and incremental updates.\n\n### The Node.js Part\n\n[The Node.js part](screenshooter/takeScreenshot.ts) uses [chrome-aws-lambda](https://github.com/alixaxel/chrome-aws-lambda) and [puppeteer-core](https://www.npmjs.com/package/puppeteer-core) to spin up a [headless](https://en.wikipedia.org/wiki/Headless_browser) version of Chrome, visit a website, and take a screenshot. It then returns the image represented as a [Base64 string](https://css-tricks.com/data-uris/). This is wrapped in an [AWS Lambda Handler](screenshooter/index.ts) and then deployed to AWS using Terraform.\n\n### The Terraform Part\n\nIt's [_one file_](main.tf) that outlines the infrastructure we need (think _blueprint_). It then _magically_ creates/updates this when we run `terraform apply` locally.\n\n## How Can I Use It?\n\n### Prerequisites\n\n1. Ensure you have Terraform installed. If you don't, [use this guide](https://learn.hashicorp.com/tutorials/terraform/install-cli).\n1. Ensure you have [an AWS account](https://console.aws.amazon.com/).\n1. Ensure you have the [AWS cli](https://aws.amazon.com/cli/).\n1. Ensure you've logged in on your system with the AWS cli and you have credentials under `~/.aws/credentials`.\n\n### Getting Started\n\n1. Clone this repo\n1. `cd` into the cloned directory\n1. `cd screenshooter` to open the Node.js part\n1. Build the lambda function with `yarn \u0026\u0026 yarn build`\n1. `cd ..` to go back\n1. `terraform init \u0026\u0026 terraform apply` to put it online\n\nOnce it's online, you'll see URLs for `dev` and `prod` stages of your deployed function!\n\nRun `terraform destroy` to tear everything down.\n\n## Keep In Touch\n\nIf you'd like to talk or be friends or whatever, [let's do it on twitter](https://twitter.com/tejaskumar_)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftejasq%2Fterraform-nodejs-screenshooter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftejasq%2Fterraform-nodejs-screenshooter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftejasq%2Fterraform-nodejs-screenshooter/lists"}