|
4 | 4 |
|
5 | 5 | This is the Serverless Framework plugin for AWS Step Functions.
|
6 | 6 |
|
| 7 | +## Requirement |
| 8 | +Serverless Framework v2.32.0 or later is required. |
| 9 | + |
7 | 10 | ## TOC
|
8 | 11 |
|
9 | 12 | - [Install](#install)
|
@@ -48,6 +51,7 @@ This is the Serverless Framework plugin for AWS Step Functions.
|
48 | 51 | - [Specifying a RoleArn](#specifying-a-rolearn)
|
49 | 52 | - [Specifying a custom CloudWatch EventBus](#specifying-a-custom-cloudwatch-eventbus)
|
50 | 53 | - [Specifying a custom EventBridge EventBus](#specifying-a-custom-eventbridge-eventbus)
|
| 54 | + - [Specifying a DeadLetterQueue](#specifying-a-deadletterqueue) |
51 | 55 | - [Tags](#tags)
|
52 | 56 | - [Commands](#commands)
|
53 | 57 | - [deploy](#deploy)
|
@@ -164,7 +168,7 @@ stepFunctions:
|
164 | 168 | dependsOn:
|
165 | 169 | - DynamoDBTable
|
166 | 170 | - KinesisStream
|
167 |
| - - CUstomIamRole |
| 171 | + - CustomIamRole |
168 | 172 | tags:
|
169 | 173 | Team: Atlantis
|
170 | 174 | activities:
|
@@ -1166,6 +1170,73 @@ stepFunctions:
|
1166 | 1170 | ...
|
1167 | 1171 | ```
|
1168 | 1172 |
|
| 1173 | +#### Specifying a DeadLetterQueue |
| 1174 | + |
| 1175 | +You can configure a target queue to send dead-letter queue events to: |
| 1176 | + |
| 1177 | +```yml |
| 1178 | +stepFunctions: |
| 1179 | + stateMachines: |
| 1180 | + exampleEventBridgeEventStartsMachine: |
| 1181 | + events: |
| 1182 | + - eventBridge: |
| 1183 | + eventBusName: 'my-custom-event-bus' |
| 1184 | + event: |
| 1185 | + source: |
| 1186 | + - "my.custom.source" |
| 1187 | + detail-type: |
| 1188 | + - "My Event Type" |
| 1189 | + detail: |
| 1190 | + state: |
| 1191 | + - pending |
| 1192 | + deadLetterConfig: 'arn:aws:sqs:us-east-1:012345678910:my-dlq' # SQS Arn |
| 1193 | + definition: |
| 1194 | + ... |
| 1195 | +``` |
| 1196 | +##### Important point |
| 1197 | +Don't forget to [Grant permissions to the dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-rule-dlq.html#eb-dlq-perms), to do that you may need to have the `ARN` of the generated `EventBridge Rule`. |
| 1198 | + |
| 1199 | +In order to get the `ARN` you can use [intrinsic functions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html) against the `logicalId`, this plugin generates `logicalIds` following this format: |
| 1200 | +```ts |
| 1201 | +`${StateMachineName}EventsRuleCloudWatchEvent${index}` |
| 1202 | +``` |
| 1203 | +Given this example 👇 |
| 1204 | +```yml |
| 1205 | +stepFunctions: |
| 1206 | + stateMachines: |
| 1207 | + hellostepfunc1: # <---- StateMachineName |
| 1208 | + events: |
| 1209 | + - eventBridge: |
| 1210 | + eventBusName: 'my-custom-event-bus' |
| 1211 | + event: |
| 1212 | + source: |
| 1213 | + - "my.custom.source" |
| 1214 | + - eventBridge: |
| 1215 | + eventBusName: 'my-custom-event-bus' |
| 1216 | + event: |
| 1217 | + source: |
| 1218 | + - "my.custom.source" |
| 1219 | + deadLetterConfig: 'arn:aws:sqs:us-east-1:012345678910:my-dlq' |
| 1220 | + name: myStateMachine |
| 1221 | + definition: |
| 1222 | + Comment: "A Hello World example of the Amazon States Language using an AWS Lambda Function" |
| 1223 | + StartAt: HelloWorld1 |
| 1224 | + States: |
| 1225 | + HelloWorld1: |
| 1226 | + Type: Task |
| 1227 | + Resource: |
| 1228 | + Fn::GetAtt: [hello, Arn] |
| 1229 | + End: true |
| 1230 | +``` |
| 1231 | +Then |
| 1232 | +```yaml |
| 1233 | +# to get the Arn of the 1st EventBridge rule |
| 1234 | +!GetAtt Hellostepfunc1EventsRuleCloudWatchEvent1.Arn |
| 1235 | + |
| 1236 | +# to get the Arn of the 2nd EventBridge rule |
| 1237 | +!GetAtt Hellostepfunc1EventsRuleCloudWatchEvent2.Arn |
| 1238 | +``` |
| 1239 | + |
1169 | 1240 | ## Tags
|
1170 | 1241 |
|
1171 | 1242 | You can specify tags on each state machine. Additionally any global tags (specified under `provider` section in your `serverless.yml`) would be merged in as well.
|
|
0 commit comments