Skip to content

Commit 21220c6

Browse files
committed
Update README
1 parent fc03b35 commit 21220c6

File tree

2 files changed

+100
-4
lines changed

2 files changed

+100
-4
lines changed

README.md

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,95 @@
11
# serverless-step-functions-local
2-
Run AWS step functions offline with Serverless
2+
Run AWS step functions offline with Serverless!
3+
4+
This is a plugin for the [Serverless Framework](https://serverless.com/). It uses [stepfunctions-localhost](https://www.npmjs.com/package/stepfunctions-localhost) to emulate step functions with AWS' provided tool for local development.
5+
6+
## Requirements
7+
8+
- The [serverless-offline](https://www.npmjs.com/package/serverless-offline) plugin
9+
- The [serverless-offline-lambda](https://www.npmjs.com/package/serverless-offline-lambda) plugin
10+
- The [serverless-step-functions](https://www.npmjs.com/package/serverless-step-functions) plugin
11+
- Java Runtime Engine (JRE) version 6.x or newer
12+
13+
## Install
14+
15+
`npm install serverless-step-functions-local -D`
16+
17+
## Getting Started
18+
19+
You'll need to add this plugin to your `serverless.yml`. The plugins section should look something like this when you're done:
20+
21+
```yaml
22+
plugins:
23+
...
24+
- serverless-step-functions
25+
- serverless-step-functions-local
26+
- serverless-offline-lambda
27+
- serverless-offline
28+
...
29+
```
30+
31+
Then, add a new section to `config` with `accountId` and `region` parameters:
32+
33+
```yaml
34+
custom:
35+
stepFunctionsLocal:
36+
accountId: 101010101010
37+
region: us-east-1
38+
```
39+
40+
Although not neccessary, it's strongly recomended to add the folder with the downloaded step function executables to `.gitignore`. By default, this path is `./.step-functions-local`.
41+
42+
## Options
43+
44+
(These go under `custom.stepFunctionsLocal`.)
45+
46+
- `accountId` (required) your AWS account ID
47+
- `region` (required) your AWS region
48+
- `lambdaEndpoint` (defaults to `http://localhost:4000`) the endpoint for the lambda service
49+
- `path` (defaults to `./.step-functions-local`) the path to store the downloaded step function executables
50+
51+
### Full Config Example
52+
53+
```yaml
54+
service: local-step-function
55+
56+
plugins:
57+
- serverless-step-functions
58+
- serverless-step-functions-local
59+
- serverless-offline-lambda
60+
- serverless-offline
61+
62+
provider:
63+
name: aws
64+
runtime: nodejs10.x
65+
66+
67+
custom:
68+
stepFunctionsLocal:
69+
accountId: 101010101010
70+
region: us-east-1
71+
72+
functions:
73+
hello:
74+
handler: handler.hello
75+
76+
stepFunctions:
77+
stateMachines:
78+
WaitMachine:
79+
definition:
80+
Comment: "An example of the Amazon States Language using wait states"
81+
StartAt: FirstState
82+
States:
83+
FirstState:
84+
Type: Task
85+
Resource: arn:aws:lambda:us-east-1:101010101010:function:hello
86+
Next: wait_using_seconds
87+
wait_using_seconds:
88+
Type: Wait
89+
Seconds: 10
90+
Next: FinalState
91+
FinalState:
92+
Type: Task
93+
Resource: arn:aws:lambda:us-east-1:101010101010:function:hello
94+
End: true
95+
```

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
"keywords": [
2323
"⚡️",
2424
"serverless",
25+
"serverless offline",
26+
"serverless plugin",
27+
"plugin",
2528
"sls",
2629
"offline",
2730
"local",
@@ -34,11 +37,11 @@
3437
"aws"
3538
],
3639
"bugs": {
37-
"url": "https://github.com/codetheweb/stepfunctions-localhost/issues"
40+
"url": "https://github.com/codetheweb/serverless-step-functions-local/issues"
3841
},
39-
"homepage": "https://github.com/codetheweb/stepfunctions-localhost#readme",
42+
"homepage": "https://github.com/codetheweb/serverless-step-functions-local#readme",
4043
"repository": {
4144
"type": "git",
42-
"url": "git+https://github.com/codetheweb/stepfunctions-localhost.git"
45+
"url": "git+https://github.com/codetheweb/serverless-step-functions-local.git"
4346
}
4447
}

0 commit comments

Comments
 (0)