处理运行手册中的超时 - Amazon Systems Manager
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

处理运行手册中的超时

timeoutSeconds 属性由所有自动化操作共享。您可以使用此属性指定操作的执行超时值。此外,您还可以更改操作超时如何影响自动化和整体执行状态。另外,您可以通过定义操作的 onFailureisCritical 共享属性来完成此操作。

例如,根据您的使用案例,您可能希望自动化继续执行其他操作,并且在操作超时的情况下不影响自动化的整体状态。在此示例中,您可以使用 timeoutSeconds 属性指定操作超时之前等待的时间长度。然后,您可以指定存在超时的情况下自动化应转到的操作(即步骤)。使用 onFailure 属性的格式 step:step name 指定值,而不是指定默认值 Abort。默认情况下,如果操作超时,在自动化执行状态将为 Timed Out。要防止超时影响自动化执行状态,请为 false 属性指定 isCritical

以下示例演示如何为此情况中描述的操作定义共享属性。

YAML
- name: verifyImageAvailability action: 'aws:waitForAwsResourceProperty' timeoutSeconds: 600 isCritical: false onFailure: 'step:getCurrentImageState' inputs: Service: ec2 Api: DescribeImages ImageIds: - '{{ createImage.newImageId }}' PropertySelector: '$.Images[0].State' DesiredValues: - available nextStep: copyImage
JSON
{ "name": "verifyImageAvailability", "action": "aws:waitForAwsResourceProperty", "timeoutSeconds": 600, "isCritical": false, "onFailure": "step:getCurrentImageState", "inputs": { "Service": "ec2", "Api": "DescribeImages", "ImageIds": [ "{{ createImage.newImageId }}" ], "PropertySelector": "$.Images[0].State", "DesiredValues": [ "available" ] }, "nextStep": "copyImage" }

有关所有自动化操作共享的属性的更多信息,请参阅 所有操作共享的属性