Skip to content

Commit 7bf46b1

Browse files
- updated README
1 parent cdac2a3 commit 7bf46b1

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ stepFunctions:
4848
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-hello
4949
End: true
5050
dependsOn: CustomIamRole
51+
alarms:
52+
topics:
53+
ok: arn:aws:sns:us-east-1:1234567890:NotifyMe
54+
alarm: arn:aws:sns:us-east-1:1234567890:NotifyMe
55+
insufficientData: arn:aws:sns:us-east-1:1234567890:NotifyMe
56+
metrics:
57+
- executionsTimeOut
58+
- executionsFailed
59+
- executionsAborted
60+
- executionThrottled
5161
hellostepfunc2:
5262
definition:
5363
StartAt: HelloWorld2
@@ -60,6 +70,16 @@ stepFunctions:
6070
- DynamoDBTable
6171
- KinesisStream
6272
- CUstomIamRole
73+
alarms:
74+
topics:
75+
ok: arn:aws:sns:us-east-1:1234567890:NotifyMe
76+
alarm: arn:aws:sns:us-east-1:1234567890:NotifyMe
77+
insufficientData: arn:aws:sns:us-east-1:1234567890:NotifyMe
78+
metrics:
79+
- executionsTimeOut
80+
- executionsFailed
81+
- executionsAborted
82+
- executionThrottled
6383
activities:
6484
- myTask
6585
- yourTask
@@ -132,6 +152,45 @@ stepFunctions:
132152
- myStream
133153
```
134154

155+
#### CloudWatch Alarms
156+
It's common practice to want to monitor the health of your state machines and be alerted when something goes wrong. You can either:
157+
158+
* do this using the [serverless-plugin-aws-alerts](https://github.com/ACloudGuru/serverless-plugin-aws-alerts), which lets you configure custom CloudWatch Alarms against the various metrics that Step Functions publishes.
159+
* or, you can use the built-in `alarms` configuration from this plugin, which gives you an opinionated set of default alarms (see below)
160+
161+
```yaml
162+
stepFunctions:
163+
stateMachines:
164+
myStateMachine:
165+
alarms:
166+
topics:
167+
ok: arn:aws:sns:us-east-1:1234567890:NotifyMe
168+
alarm: arn:aws:sns:us-east-1:1234567890:NotifyMe
169+
insufficientData: arn:aws:sns:us-east-1:1234567890:NotifyMe
170+
metrics:
171+
- executionsTimeOut
172+
- executionsFailed
173+
- executionsAborted
174+
- executionThrottled
175+
```
176+
177+
Both `topics` and `metrics` are required properties. There are 4 supported metrics, each map to the CloudWatch Metrics that Step Functions publishes for your executions.
178+
179+
The generated CloudWatch alarms would have the following configurations:
180+
```yaml
181+
namespace: 'AWS/States'
182+
metric: <ExecutionsTimeOut | ExecutionsFailed | ExecutionsAborted | ExecutionThrottled>
183+
threshold: 1
184+
period: 60
185+
evaluationPeriods: 1
186+
ComparisonOperator: GreaterThanOrEqualToThreshold
187+
Statistic: Sum
188+
treatMissingData: missing
189+
Dimensions:
190+
- Name: StateMachineArn
191+
Value: <ArnOfTheStateMachine>
192+
```
193+
135194
#### Current Gotcha
136195
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.
137196

0 commit comments

Comments
 (0)