Skip to content

Commit 73cd129

Browse files
authored
Merge pull request #198 from horike37/feature/cw_events_notificaiton
Feature/cw events notifications
2 parents 1251944 + eab4900 commit 73cd129

10 files changed

+914
-7
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ language: node_js
22

33
matrix:
44
include:
5-
- node_js: '6.2'
65
- node_js: '8.9'
76
- node_js: '10.6'
87
- node_js: '10.6'

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,46 @@ alarms:
226226
treatMissingData: ignore # default
227227
```
228228

229+
#### CloudWatch Notifications
230+
231+
You can monitor the execution state of your state machines [via CloudWatch Events](https://aws.amazon.com/about-aws/whats-new/2019/05/aws-step-functions-adds-support-for-workflow-execution-events/). It allows you to be alerted when the status of your state machine changes to `ABORTED`, `FAILED`, `RUNNING`, `SUCCEEDED` or `TIMED_OUT`.
232+
233+
You can configure CloudWatch Events to send notification to a number of targets. Currently this plugin supports `sns`, `sqs`, `kinesis`, `firehose`, `lambda` and `stepFunctions`.
234+
235+
To configure status change notifications to your state machine, you can add a `notifications` like below:
236+
237+
```yml
238+
stepFunctions:
239+
stateMachines:
240+
hellostepfunc1:
241+
name: test
242+
definition:
243+
...
244+
notifications:
245+
ABORTED:
246+
- sns: SNS_TOPIC_ARN
247+
- sqs: SQS_TOPIC_ARN
248+
- sqs: # for FIFO queues, which requires you to configure the message group ID
249+
arn: SQS_TOPIC_ARN
250+
messageGroupId: 12345
251+
- lambda: LAMBDA_FUNCTION_ARN
252+
- kinesis: KINESIS_STREAM_ARN
253+
- kinesis:
254+
arn: KINESIS_STREAM_ARN
255+
partitionKeyPath: $.id # used to choose the parition key from payload
256+
- firehose: FIREHOSE_STREAM_ARN
257+
- stepFunctions: STATE_MACHINE_ARN
258+
FAILED:
259+
... # same as above
260+
... # other status
261+
```
262+
263+
As you can see from the above example, you can configure different notification targets for each type of status change. If you want to configure the same targets for multiple status changes, then consider using [YML anchors](https://blog.daemonl.com/2016/02/yaml.html) to keep your YML succinct.
264+
265+
CloudFormation intrinsic functions such as `Ref` and `Fn::GetAtt` are supported.
266+
267+
When setting up a notification target against a FIFO SQS queue, the queue must enable the content-based deduplication option and you must configure the `messageGroupId`.
268+
229269
#### Current Gotcha
230270

231271
Please keep this gotcha in mind if you want to reference the `name` from the `resources` section. To generate Logical ID for CloudFormation, the plugin transforms the specified name in serverless.yml based on the following scheme.

0 commit comments

Comments
 (0)