本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
将 更改日历 依赖项添加到 Automation 文档
若要使 Automation 操作遵守 Systems Manager 更改日历,请在使用 aws:assertAwsResourceProperty 操作的 Automation 文档中添加一个步骤。将操作配置为运行 GetCalendarState
以验证指定的日历条目是否处于所需状态(OPEN
或 CLOSED
)。仅当日历状态为 OPEN
时,才允许 Automation 文档继续执行下一步。 以下是 Automation 文档基于 YAML 的示例摘录,除非日历状态与在 LaunchInstance
中指定的状态 OPEN
匹配,否则该文档无法前进到下一步 DesiredValues
。
mainSteps: - name: MyCheckCalendarStateStep action: 'aws:assertAwsResourceProperty' inputs: Service: ssm Api: GetCalendarState CalendarNames: 'arn:aws:ssm:us-east-1:123456789012:document/SaleDays' PropertySelector: '$.State' DesiredValues: - OPEN description: "Use GetCalendarState to determine whether a calendar is open or closed." nextStep: LaunchInstance - name: LaunchInstance action: 'aws:executeScript' inputs: Runtime: python3.6 ...