What happens during serverless and cloudformation update

I am questioning my design so I was wondering what happens during cloudformation update process.
Specifically with scheduled events, basically if i have scheduled event running on every minute and stack is in update process while event triggers.
The reason I am asking this is because a single step machine as far as i know can run up to a year. Mine has a decent chance to run in a loop for an 10-15min(if i get enough users). and is triggered every minute.

I am worried about scenario:

  1. stack is in update
  2. scheduled event is triggered
  3. scheduled event triggers step function
  4. step function does half of work
  5. stack finished updating
  6. what happens with rest of step functions? does state machine gets terminated inside execution?

Is the process something like this:

  1. create new stack
  2. swap new lambdas in place of old ones for future execution
  3. let old code finish execution.
  4. delete old lambdas and step functions

Also is there a possibility scheduled event won’t get triggered during update process?

Are you using the step functions plugin to manage your step functions? https://serverless.com/blog/how-to-manage-your-aws-step-functions-with-serverless/

From what I have seen, it doesn’t deletes any ‘in progress’ flows when updating.

Yep that’s what I am using. <3 for Takahiro for making it
So you think the old code should finish executing on old lambdas?

Hmmm it looks like if you change the lambda it will effect other flows. At least with this set up https://github.com/DavidWells/serverless-workshop/tree/master/lessons-code-complete/events/step-functions where a lambda is scheduled to trigger at a given timestamp.

However there MUST be a way to stop this from happening. IDK how tho ¯_(ツ)_/¯

There were some improvements made to step functions recently https://aws.amazon.com/about-aws/whats-new/2017/11/aws-step-functions-adds-support-for-updating-state-machines/ to update old flows