2

我正在使用 AWS SSM 在 ec2 实例上计算一个长脚本。

我想配置执行超时(执行时间,而不是启动时间),我在官方文档中找不到如何执行此操作(反对信息或不工作)。

我只使用 CLI 界面。

4

1 回答 1

1

该值是一个文档属性,可以使用键通过--parameters选项传递。executionTimeout您可以使用它aws ssm describe-documents来查找此和其他文档特定参数。

aws ssm describe-document --name "AWS-RunShellScript"

{
    "Document": {
        "Hash": "99749de5e62f71e5ebe9a55c2321e2c394796afe7208cff048696541e6f6771e",
        "HashType": "Sha256",
        "Name": "AWS-RunShellScript",
        "Owner": "Amazon",
        "CreatedDate": "2017-08-21T22:25:02.029000+02:00",
        "Status": "Active",
        "DocumentVersion": "1",
        "Description": "Run a shell script or specify the commands to run.",
        "Parameters": [
            {
                "Name": "commands",
                "Type": "StringList",
                "Description": "(Required) Specify a shell script or a command to run."
            },
            {
                "Name": "workingDirectory",
                "Type": "String",
                "Description": "(Optional) The path to the working directory on your instance.",
                "DefaultValue": ""
            },
            {
                "Name": "executionTimeout",
                "Type": "String",
                "Description": "(Optional) The time in seconds for a command to complete before it is considered to have failed. Default is 3600 (1 hour). Maximum is 172800 (48 hours).",
                "DefaultValue": "3600"
            }
        ],
        "PlatformTypes": [
            "Linux",
            "MacOS"
        ],
        "DocumentType": "Command",
        "SchemaVersion": "1.2",
        "LatestVersion": "1",
        "DefaultVersion": "1",
        "DocumentFormat": "JSON",
        "Tags": []
    }
}
于 2021-01-22T16:38:24.077 回答