|
2 | 2 |
|
3 | 3 | Boilerplate for running Headless-Chrome by [Puppeteer](https://github.com/GoogleChrome/puppeteer) on AWS Lambda.
|
4 | 4 |
|
| 5 | +## Run on local |
| 6 | + |
| 7 | +By executing `npm run local`, you can check the operation while actually viewing the chrome. (non-headless, slowmo) |
| 8 | + |
5 | 9 | ## Packaging & Deploy
|
6 | 10 |
|
7 | 11 | Lambda's memory is set to 384 MB or more.
|
8 | 12 |
|
9 |
| -### chrome in package (recommend) |
| 13 | +### chrome in package (recommended) |
10 | 14 |
|
11 | 15 | Run `npm run package`, and deploy the package.zip.
|
12 | 16 |
|
13 | 17 | ### chrome NOT in package
|
14 | 18 |
|
15 |
| -Due to the large size of Chrome, it may exceed the [Lambda package size limit](http://docs.aws.amazon.com/lambda/latest/dg/limits.html) (50 MB) depending on the other module to include. |
| 19 | +Due to the large size of Chrome, it may exceed the [Lambda package size limit](http://docs.aws.amazon.com/lambda/latest/dg/limits.html) (50MB) depending on the other module to include. |
16 | 20 | In that case, put Chrome in S3 and download it at container startup so startup time will be longer.
|
17 | 21 |
|
18 | 22 | Run `npm run package-nochrome`, deploy the package.zip, and set following env valiables on Lambda.
|
19 | 23 |
|
20 | 24 | - `CHROME_BUCKET`(required): S3 bucket where Chrome is put
|
21 |
| -- `CHROME_KEY`(optional): S3 key. default: headless_shell.tar.gz |
| 25 | +- `CHROME_KEY`(optional): S3 key. default: `headless_shell.tar.gz` |
22 | 26 |
|
23 | 27 | ## Build Headless-Chrome (optional)
|
24 | 28 |
|
25 | 29 | If you want to use latest chrome, run chrome/buildChrome.sh on EC2 having at least 16GB memory and 30GB volume.
|
26 | 30 | See also [serverless-chrome](https://github.com/adieuadieu/serverless-chrome/blob/master/chrome/README.md).
|
27 |
| -Once you build it, link to headless_shell.tar.gz in /chrome. |
| 31 | +Once you build it, link to `headless_shell.tar.gz` in `chrome` dir. |
28 | 32 |
|
29 |
| -## Reference |
| 33 | +## Article |
30 | 34 |
|
31 |
| -[記事](https://www.sambaiz.net/article/132/) |
| 35 | +[PuppeteerでHeadless Chromeを動かすコードをLambdaで実行する - sambaiz-net](https://www.sambaiz.net/article/132/) |
0 commit comments