You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-17Lines changed: 7 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
## lambdium
2
2
### headless chrome + selenium webdriver in AWS Lambda
3
3
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.**
5
5
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:
7
7
8
8
* Run many concurrent selenium scripts at the same time without worrying about the infrastructure
9
9
* 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
33
33
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).
34
34
35
35
```sh
36
-
$ ./scripts/fetch-dependencies.sh
36
+
$ ./layer/fetch-binaries.sh
37
37
```
38
38
39
-
##### 2. Cleaning up the `node_modules` directory to reduce function size
39
+
##### 2. Building
40
40
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:
50
42
51
43
```sh
52
-
$ modclean --patterns="default:*"
44
+
$ sam build
53
45
```
54
46
55
-
Follow the prompts and choose 'Y' to remove extraneous files from `node_modules`.
56
-
57
47
##### 3. Running locally with SAM Local
58
48
59
49
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
79
69
#### 2. Packaging the function for Cloudformation using SAM
80
70
81
71
```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
0 commit comments