Last active
June 1, 2018 11:22
-
-
Save ronyis/ac51d6485156b2391771b00e31a886b9 to your computer and use it in GitHub Desktop.
Example of a Serverless system with Step Functions invoked by SNS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: state-machine-invoking-example | |
provider: | |
name: aws | |
region: eu-west-1 | |
runtime: python3.6 | |
# Specific Role for the Lambda and machine is better | |
iamRoleStatements: | |
- Effect: "Allow" | |
Action: | |
- "states:StartExecution" | |
Resource: | |
- "*" | |
functions: | |
first_step: | |
handler: simple_lambda.run | |
second_step: | |
handler: another_lambda.run | |
timeout: 5 | |
machine_invoker: | |
handler: state_machine_invoker.run | |
events: | |
- sns: 'arn:aws:sns:eu-west-1:xxxxxxxx:sns_name' | |
custom: | |
env-resources: | |
- MyStateMachine | |
stepFunctions: | |
stateMachines: | |
exampleMachine: | |
name: myStateMachine | |
definition: | |
StartAt: firstStep | |
States: | |
firstStep: | |
Type: Task | |
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-first_step | |
TimeoutSeconds: 6 | |
Next: secondStep | |
secondStep: | |
Type: Task | |
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-second_step | |
TimeoutSeconds: 5 | |
End: true | |
plugins: | |
- serverless-step-functions | |
- serverless-pseudo-parameters | |
- serverless-resources-env |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment