Skip to content

Instantly share code, notes, and snippets.

@imewish
Created February 19, 2023 06:47
Show Gist options
  • Save imewish/7924bc329c29d5a8c5f4dd6e58aad696 to your computer and use it in GitHub Desktop.
Save imewish/7924bc329c29d5a8c5f4dd6e58aad696 to your computer and use it in GitHub Desktop.
stateMachines:
RunLambdaEveryXsecond:
events:
- schedule:
rate: rate(1 minute)
enabled: false
input:
counter: 0
name: RunLambdaEveryXsecond
definition:
Comment: A description of my state machine
StartAt: Pass
States:
Pass:
Type: Pass
Next: Choice
Parameters:
counter.$: States.MathAdd($.counter, 1)
Choice:
Type: Choice
Choices:
- Variable: $.counter
NumericLessThanEquals: 6
Next: Lambda Invoke
Default: Pass (1)
Lambda Invoke:
Type: Task
Resource: arn:aws:states:::lambda:invoke
Parameters:
FunctionName: >-
arn:aws:lambda:${aws:region}:${aws:accountId}:function:ur-function-name:$LATEST
InvocationType: Event
Retry:
- ErrorEquals:
- Lambda.ServiceException
- Lambda.AWSLambdaException
- Lambda.SdkClientException
- Lambda.TooManyRequestsException
IntervalSeconds: 2
MaxAttempts: 6
BackoffRate: 2
Next: Wait
ResultPath: null
Wait:
Type: Wait
Seconds: 10
Next: Pass
Pass (1):
Type: Pass
End: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment