-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AWS Step Functions support #3024
Comments
How would this work? Would people have to write their own FSM using AWSSL? |
IMO,since the Json format is very simple(unlike cloudformation),It will be a good idea to write FSM using AWSSL and let serverless handle that for you. |
it's also possible to define a Task("Activity") without ARN that will ping an HTTP endpoint. |
@horike37 just released the very cool "Step Functions" plugin so you can use them now in Serverless 👍 : https://github.com/horike37/serverless-step-functions |
Can this issue be closed then? |
Not sure if we should put this into core some time (based on @horike37 plugin)... Any thoughts @eahefnawy @nikgraf @mthenw ? |
We may add it, but I'm guessing the design won't exactly match @horike37 plugin...mainly for cross-provider compatibility reasons. I feel that the config used with that plugin is too AWS specific. |
If you consider multi-providers, implementing provider-specific feature on the core may make maintenance difficult. If CF supports, it may become to update correctly. |
I think it should be in the core since it's the really one way to support flows and keep the function small(and not mini-application).I like the idea that @horike37 plugin support the aws step file. |
How would this work finally? |
Hey everyone here. provider:
name: aws
runtime: nodejs4.3
custom:
accountId: xxxxxx
functions:
hellofunc:
handler: handler.hello
stepFunctions:
role: arn:aws:iam:::role/InsertYourFavoriteRoleNameHere #Optional, you can chose the existing IAM Role
stateMachines:
myStateMachine1:
events: #Here is events for stepfunctions. You can define http, schedule and cloudwatchEvent.
- http:
method: GET
path: executeMyStateMachine
- schedule: rate(2 hours)
- cloudwatchEvent:
event:
source:
- "aws.ec2"
detail-type:
- "EC2 Instance State-change Notification"
detail:
state:
- pending
definition: #Required. Here is the Amazon States Language definition.
Comment: "A Hello World example of the Amazon States Language using an AWS Lambda Function"
StartAt: HelloWorld1
States:
HelloWorld1:
Type: Task
Resource: arn:aws:lambda:${opt:region}:${self:custom.accountId}:function:${self:service}-${opt:stage}-hello
End: true
hellostepfunc2:
definition:
StartAt: HelloWorld2
States:
HelloWorld2:
Type: Task
Resource: arn:aws:states:${opt:region}:${self:custom.accountId}:activity:${self:service}-${opt:stage}-myTask
End: true
activities: #Here is Task activites
- myTask |
Additionally, we should extend |
Thanks for jumping on this @horike37 👍 Not 100% sure about the syntax yet. But TBH I haven't thought that much about it yet to provide a better proposal. Is it possible to build this more around the Lamdba functions rather than as a separate kind of resource / section in the Curious what others who've used step functions think how this should look like... /cc @serverless/vip |
@horike37 don't you think we need some kind of link between |
@pmuens @horike37 This function reference seems a bit too hard-coded for me:
The same for the activity reference. Woudn't the reference be easier by referencing the function via "Ref" or "GetAtt"? Function naming is a integral part of the framework itself (provider.naming module) and having the need to assemble the arns manually would increase the risk of errors. That's what you meant with the previous comment, @lielran ? |
Does it mean to define stepfunction setting in
@lielran @HyperBrain |
@horike37 For lambda functions you can get the logical id with
You can easily deduct the resource name with the given function from naming. Internally you can then set In general, I would allow the definition to have multiple ways of linking a function into the step resources. Also manually specifying an Arn parameter that you also copy to Resource. |
@pmuens IMO, breaking the step functions apart (so as to define pieces under function definitions) would be a nightmare. To reason about a step function you need it collected in a single reviewable chunk. Additionally, it might prohibit or at least make awkward defining Passed, Fail, Succeed, Type: Activity, and Parallel (others?) state types (where would you attach them). |
Additionally, I strongly support the integration of StepFunction support into the existing deploy command. Same with regard to the invoke command but with -sf as an additional short version of the flag. |
@erikerikson Indeed. #3212 is the proposal for that. It should provide a universal Arn paser including the detection of refs, getatts and - additionally - the function name case should be added. |
Thanks @HyperBrain |
@horike37 some feedback and then a modified example desired target follow.
Thank you! |
Thanks for the proposal @erikerikson and @HyperBrain ! @pmuens, do you have any opinion? |
Thank you very much for all the really helpful feedback! Really appreciate this as it's always super nice to have different opinions and approaches which are derived from different use-cases. So thanks everyone 🙌 🥇 We also discussed this exact issue internally yesterday. The conclusion was that we're about to postpone the integration of AWS specific step functions into the Framework core for now. The main reason is that we're looking into ways how we can do this in a way where we support multiple providers. We'll open up a separate issue for this in the future and take all the feedback from here and incorporate it into a proposal we can then discuss in the new issue. Furthermore we came up with a "general rule" that everything provider dependent should be prefixed in the future (like @horike37 Thank you very much for getting this started again and pushing hard to get step functions support into core. Could you continue the work on AWS step function support based on the feedback / proposals above in the |
@pmuens Thank you for the repley 😄
Of cource! Based on the feedback I got here, I will release the plugin as v1.0 😆 |
Thank you very much for your understanding! It always feels bad to postpone / reject feature requests since real people invest their valuable time 🕐 ...
Glad to hear that. I hope that the feedback provided above helps with the new implementation. Please keep us posted in this issue and let us know if you need any further feedback or need any help! 👍 |
@pmuens, can you expand "how we can do this in a way where we support multiple providers"? Are you talking about something like the following?
|
🤔 we don't have any specific implementation ideas about that yet so any kind of feedback on this is highly welcomed! The first, initial idea is to define the functions and then compose them so that they replicate the AWS step-functions implementation in a more abstracted way. But nothing set in 🗿 yet... |
@pmuens I'd be wary of abstracting an already rather abstract service. That said, if there are clean yet correct and complete ways to simplify the engine definition, I wouldn't mind. They're a bit of a bear to define and formulate in their full statement. Mostly, in my very limited experience, due to error handling. Variables could be used to avoid that problem though, so I'm not sure how much of a win there would be, especially as there were attempts to stretch the concept beyond AWS. Perhaps, a template that would be merged on top of for each declared state would allow for the avoidance of re-declaring various fields over and over unless you really wanted a special case or behavior. Perhaps even a default template that would be merged over by an optionally declared template that would be merged over by any declared concrete state. A naive though, almost surely. An example of the verbosity of some state definitions given responsible error handling and whatnot follows. It declares "run a lambda, retrying failures three times before giving up and proceeding upon success" (I should probably notify the myself via SNS for any terminal error and then work on automating them all away but... priorities and all).
|
Just released Serverless Step Functions Plugin v1.0 |
I need some help troubleshooting an issue with the plugin. I'm following @horike37 's example. When i try to deploy, only the lambda gets deployed, not the step function. No errors are thrown. When i check cloudformation, there is no json code that describes step function nor state machines. Appreciate any help! |
@kaiser14 I would provide you with some of help on there. |
@horike37 Thanks for looking into this. I've opened a new issue and attached the serverless.yml: serverless-operations/serverless-step-functions#70 |
aws step functions support
Feature proposals:
The text was updated successfully, but these errors were encountered: