Skip to content

Commit 9ca07ad

Browse files
committed
update readme
1 parent 2894a2e commit 9ca07ad

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

README.md

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## lambdium
22
### headless chrome + selenium webdriver in AWS Lambda
33

4-
**Lambdium allows you to run a Selenium Webdriver script written in Javascript inside of an AWS Lambda function bundled with [Headless Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome).**
4+
**Lambdium uses Selenium Webdriver with [Headless Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) to run Webdriver scripts written in JavaScript on AWS Lambda.**
55

6-
You can use this AWS Lambda function by itself or with other AWS services to:
6+
You can use this AWS Lambda function by itself, bundled with your own application as a standalone AWS Lambda layer, or with other AWS services to:
77

88
* Run many concurrent selenium scripts at the same time without worrying about the infrastructure
99
* Run execute a selenium script via an HTTP call using API Gateway ([example app](/examples/apps/api-gateway.yaml))
@@ -33,27 +33,17 @@ This uses a special version of Chrome (headless chromium) from the [serverless-c
3333
The headless chromium binary is too large for Github, you need to fetch it using a script bundled in this repository. [Marco Lüthy](https://github.com/adieuadieu) has an excellent post on Medium about how he built chromium for for AWS Lambda [here](https://medium.com/@marco.luethy/running-headless-chrome-on-aws-lambda-fa82ad33a9eb).
3434

3535
```sh
36-
$ ./scripts/fetch-dependencies.sh
36+
$ ./layer/fetch-binaries.sh
3737
```
3838

39-
##### 2. Cleaning up the `node_modules` directory to reduce function size
39+
##### 2. Building
4040

41-
It's a good idea to clean the `node_modules` directory before packaging to make the function size significantly smaller (making the function run faster!). You can do this using the `modclean` package:
42-
43-
To install it:
44-
45-
```sh
46-
$ npm i -g modclean
47-
```
48-
49-
Then, run:
41+
This is now handled by the `sam build` command. In the root of this project, run:
5042

5143
```sh
52-
$ modclean --patterns="default:*"
44+
$ sam build
5345
```
5446

55-
Follow the prompts and choose 'Y' to remove extraneous files from `node_modules`.
56-
5747
##### 3. Running locally with SAM Local
5848

5949
SAM Local can run this function on your computer inside a Docker container that acts like AWS Lambda. To run the function with an example event trigger that uses selenium to use headless chromium to visit `google.com`, run this:
@@ -79,7 +69,7 @@ You need to create a S3 bucket configured on your AWS account to upload the pack
7969
#### 2. Packaging the function for Cloudformation using SAM
8070

8171
```sh
82-
$ sam package --template-file template.yaml --s3-bucket $LAMBDA_BUCKET_NAME --output-template-file packaged.yaml
72+
$ sam package --s3-bucket $LAMBDA_BUCKET_NAME > packaged.yaml
8373
```
8474

8575
#### 3. Deploying the package using SAM

template.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ Resources:
1616
Description: Headless Chromium and Selenium WebDriver
1717
ContentUri: ./layer
1818
CompatibleRuntimes:
19-
- nodejs6.10
2019
- nodejs8.10
21-
- python3.6
2220
- python3.7
2321
- python2.7
2422
- go1.x

0 commit comments

Comments
 (0)