@@ -4,19 +4,8 @@ This guide will walk you through creating and testing a simple Lambda function.
4
4
5
5
We will then upload it to IronWorker and run it.
6
6
7
- ## Prerequisites
8
-
9
- TODO: Update these to use real ironcli static build. Also add ironcli
10
- installation instructions.
11
-
12
- We are going to use a development branch of ` ironcli ` instead of the official
13
- release. TODO: ` go install ` will fail due to (lack of) vendoring.
14
-
15
- $ cd $GOPATH
16
- $ go get github.com/iron-io/ironcli
17
- $ cd src/github.com/iron-io/ironcli
18
- $ git checkout -t origin/lambda
19
- $ go install .
7
+ We need the the ` ironcli ` tool for the rest of this guide. You can install it
8
+ by following [ these instructions] ( https://github.com/iron-io/ironcli ) .
20
9
21
10
## Creating the function
22
11
@@ -46,7 +35,7 @@ Create an empty directory for your project and save this code in a file called
46
35
Now let's use ` ironcli ` 's Lambda functionality to create a Docker image. We can
47
36
then run the Docker image with a payload to execute the Lambda function.
48
37
49
- $ ironcli lambda create-function --function-name irontest/node-exec:1 --runtime nodejs --handler node_exec.handler node_exec.js
38
+ $ iron lambda create-function --function-name irontest/node-exec:1 --runtime nodejs --handler node_exec.handler node_exec.js
50
39
Image output Step 1 : FROM iron/lambda-nodejs
51
40
---> 66fb7af42230
52
41
Step 2 : ADD node_exec.js ./node_exec.js
@@ -79,7 +68,7 @@ You should now see the generated Docker image.
79
68
The ` test-function ` subcommand can launch the Dockerized function with the
80
69
right parameters.
81
70
82
- $ ironcli lambda test-function --function-name irontest/node-exec:1 --payload '{ "cmd": "echo Dockerized Lambda" }'
71
+ $ iron lambda test-function --function-name irontest/node-exec:1 --payload '{ "cmd": "echo Dockerized Lambda" }'
83
72
Dockerized Lambda!
84
73
85
74
You should see the output. Try changing the command to ` date ` or something more
@@ -107,7 +96,7 @@ The `publish-function` command first uploads the image to Docker Hub, then
107
96
registers it with IronWorker so you can queue tasks or launch a task in
108
97
response to a webhook.
109
98
110
- $ $GOPATH/bin/ironcli lambda publish-function --function-name irontest/node-exec:1
99
+ $ iron lambda publish-function --function-name irontest/node-exec:1
111
100
-----> Configuring client
112
101
Project '<project name>' with id='<project id>'
113
102
-----> Registering worker 'irontest/node-exec'
@@ -121,7 +110,7 @@ page.
121
110
122
111
We can now run this from the command line.
123
112
124
- $ $GOPATH/bin/ironcli worker queue -payload '{ "cmd": "echo Dockerized Lambda" }' -wait irontest/node-exec
113
+ $ iron worker queue -payload '{ "cmd": "echo Dockerized Lambda" }' -wait irontest/node-exec
125
114
-----> Configuring client
126
115
Project '<project name>' with id='<project id>'
127
116
-----> Queueing task 'irontest/node-exec'
0 commit comments