amazon-web-servicesaws-ssmamazon-systems-managerruncommand

AWS SSM Command Document - Constrain instances to choose from


I'm creating an SSM Command document to use with Run Command. This Run Command will operate on a schedule. One thing I'm unclear about is if there is any way to prevent choosing instances (as pictured below). I need this one command to run against a specific instance every time and I need run command to know exactly which instances to target for the automated schedule.

Can I pass in the instance-id maybe somewhere in the document or elsewhere so that the same instance is targeted for every run? Also, if I don't want to pass in an instance ID, can I pass in a tag key-value pair?

enter image description here


Solution

  • I realized SSM Maintenance Window lets you select instances based on instance ID or tag when selecting targets after creating the maintenance window. Tasks can then be assigned afterwards.