[Python] Flow Overview 1. Document 1 (Tagging Stopped Instances for Patching) Collects all...

Discussão em 'Python' iniciado por Stack, Fevereiro 20, 2025.

  1. Stack

    Stack Membro Participativo

    Need to create ssm document (python) Flow Overview 1. Document 1 (Tagging Stopped Instances for Patching) Collects all stopped instances that have the patchwindow tag. Extracts the patch schedule from the tag (e.g., Weekofday:02:20 → Tuesday at 20:00). Determines the scheduled patching time and adds 1.5 hours as start-after time. Tags the instance with: cldfrc:scheduling:start-after = 21:30 (example). cldfrc:schedudling:disable = true (to prevent auto-stop). startedby = opsteam (to track instances started by automation). 2. Document 2 (Removing Tags and Starting Instances) Accepts an instance ID as input. Describes the instance to check if startedby = opsteam. If found, removes the cldfrc:scheduling:start-after and cldfrc:schedudling:disable tags. Starts the instance. Detailed Flow Step 1: Identify and Tag Stopped Instances SSM Document 1 runs and fetches all stopped instances. It checks if they have a patchwindow tag. The patch window tag contains information like Weekofday:02:20 (Tuesday at 20:00). The script: Converts the day and time into an actual schedule. Calculates start-after = patch time + 1.5 hours. Adds the required tags to the instance. Step 2: Process Tagged Instances in the Second Document SSM Document 2 runs, triggered by external automation or a user action. It takes an instance ID as input. Describes the ins to check if it was tagged as startedby = opsteam. If the tag is found, it removes: cldfrc:scheduling:start-after. cldfrc:schedudling:disable.

    Python script flow or something.

    Continue reading...

Compartilhe esta Página