Search code examples
amazon-web-servicesaws-ssm

AWS SSM Document Automation loop


I am writing an AWS SSM Document Automation that will check resource status and send an email with report, so that a user can fix potential errors. The thing is I want document to wait for some time, check status again and if it's not valid then send an email again.

Document Steps:

  1. Check Status
  2. If valid - end, else go to step 3
  3. Send email about not valid resource
  4. Wait for X minutes
  5. Go back to Step 1

Is it even possible to make a loop in AWS SSM Document Automation? If it is, then how to manage its number of iterations? Can I modify initial input parameters values?

I know that I can just invoke step functions and make a loop there(or just do everything step functions), but I want to avoid deploying more resources than necessary.


Solution

  • in conclusion, SSM Document Automation does not provide loop.

    but, you can make a conditional branching so you can do step 1, 2, 3, 5. If you want to make wait for Xminutes, you should use aws:executeScript in Automation Document Action.

    The most important thing is you can not go back to step 1. you should make the endpoint in the Document.