README.md in simplerubysteps-0.0.10 vs README.md in simplerubysteps-0.0.11
- old
+ new
@@ -8,11 +8,10 @@
## Installation and Usage
### Prerequisites
-* AWS CLI installed (mainly for debugging privileges)
* Configured AWS CLI profile with sufficient permissions to create IAM roles and policies, create Lambda functions, create and run Step Functions state machines, run CloudWatch log queries, etc.
### Install the gem and the srs CLI
```
@@ -20,95 +19,94 @@
```
### Create an AWS Step Function State Machine with the simplerubysteps Ruby DSL
```
-mkdir -p samples/hello-world-2
-cd samples/hello-world-2
+mkdir -p samples/hello-world-3
+cd samples/hello-world-3
vi workflow.rb
```
#### Hello World State Machine (workflow.rb)
```
require "simplerubysteps"
include Simplerubysteps
-kind "EXPRESS"
GERMAN_WORDS = ["Hallo"]
def is_german?(word)
GERMAN_WORDS.include? word
end
task :start do
transition_to :german do |data|
- is_german? data["hello"]
+ is_german? data["hi"]
end
default_transition_to :english
end
task :german do
action do |data|
- { hello_world: "#{data["hello"]} Welt!" }
+ { hello_world: "#{data["hi"]} Welt" }
end
end
task :english do
action do |data|
- { hello_world: "#{data["hello"]} World!" }
+ { hello_world: "#{data["hi"]} World" }
end
end
```
### Deploy the Step Functions State Machine and the Lambda function that implements the Task Actions (with srs deploy)
```
export AWS_PROFILE=<AWS CLI profile name with sufficient privileges>
-cd samples/hello-world-2
+cd samples/hello-world-3
srs deploy
```
### Trigger State Machine executions (with srs start)
```
export AWS_PROFILE=<AWS CLI profile name with sufficient privileges>
-cd samples/hello-world-2
+cd samples/hello-world-3
-# Bellow: will print "Hello World!"
-echo '{"hello":"Hello"}'|srs start|jq -r ".output"|jq -r ".hello_world"
-
-# Bellow: will print "Hallo Welt!"
-echo '{"hello":"Hallo"}'|srs start|jq -r ".output"|jq -r ".hello_world"
+export OPEN_AWS_CONSOLE_EXECUTION_DETAILS_PAGE_URL_PREFIX="https://eu-central-1.console.aws.amazon.com/states/home?region=eu-central-1#/v2/executions/details/"
```
-### Delete CloudFormation stack (with srs destroy)
+#### Sample execution 1 (Hello World)
```
-export AWS_PROFILE=<AWS CLI profile name with sufficient privileges>
-cd samples/hello-world-2
-
-srs destroy
+echo '{"hi":"Hello"}'|srs start --wait > result.json
+cat result.json|jq -r ".output"|jq -r ".hello_world"
+open "$OPEN_AWS_CONSOLE_EXECUTION_DETAILS_PAGE_URL_PREFIX$(cat result.json|jq -r ".execution_arn")"
```
-## Development
+![Sample Englisch execution](samples/hello-world-3/docs/sample_execution_english.png)
-To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
+#### Sample execution 2 (Hallo Welt)
-### TODOs
+```
+echo '{"hi":"Hallo"}'|srs start --wait > result.json
+cat result.json|jq -r ".output"|jq -r ".hello_world"
+open "$OPEN_AWS_CONSOLE_EXECUTION_DETAILS_PAGE_URL_PREFIX$(cat result.json|jq -r ".execution_arn")"
+```
-* Custom IAM policies per Lambda task (e.g. to allow a task to send a message to an SQS queue)
-* Workflow task/action unit test support
-* Better error handling and reporting
-* Improved stack update strategy (e.g. renamed or added task scenario)
-* ...
+![Sample German execution](samples/hello-world-3/docs/sample_execution_german.png)
-## Contributing
+### Delete CloudFormation stack (with srs destroy)
-Bug reports and pull requests are (soon - after alpha phase) welcome on GitHub at https://github.com/chtz/simplerubysteps
+```
+export AWS_PROFILE=<AWS CLI profile name with sufficient privileges>
+cd samples/hello-world-3
+
+srs destroy
+```
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).