How do you modify the Maintenance Window Task Invocation Execution Timeout via CDK

0

Hello, I have a CDK application that is spinning up a Systems Manager Maintenance Window with a registered task. During the invocation of that task, I notice it runs for 1h 10mins. This is the timeoutSeconds: 600 specified in the taskInvocationParameters plus the 'Execution Timeout' default 3600 which is applied under the hood by Systems Manager. I can see both these values in the Task Invocation in the AWS Console, but I cannot find the way to modify the Execution Timeout. I can only modify the timeoutSeconds.

This may be a misunderstanding, but timeoutSeconds is the time to wait if a command hasnt begun. This is not what I want to modify, I want to extend the overall timeout of the invocation.

This doc https://docs.aws.amazon.com/systems-manager/latest/userguide/monitor-commands.html?icmpid=docs_ec2_console#monitor-about-status-timeouts suggests that overall timeout is a combination of timeoutSeconds & Execution Timeout, which I do observe.

I have 2 main questions:

  1. If I modify timeoutSeconds, this will increase the overall time of the invocation, but will this impact the underlying executions if for example, a server gets locked up.
  2. How, using the CDK do you expose the Execution Timeout? The documentation is not clear how this is implemented within a Maintenance Window Task Invocation

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowruncommandparameters.html

In this document, it shows the timeoutSeconds. But it does not show Execution Timeout or how to implement this within Parameters

Thanks

liamab
feita há 4 meses207 visualizações
1 Resposta
0

Hello,

The Execution timeout value is passed to the command plugin using input parameter "timeoutSeconds" as shown in below SSM document:

- action: aws:runShellScript
    name: Sleep2M
    inputs:
      runCommand:
      - "echo \"Testing timeout\""
      - "sleep 60"
      timeoutSeconds: '180'   <------- This is execution timeout

The "TimeoutSeconds" parameter in MaintenanceWindowRunCommandParameters API is the Delivery timeout value.

To answer your queries,

1. If I modify timeoutSeconds, this will increase the overall time of the invocation, but will this impact the underlying executions if for example, a server gets locked up.

  • If you specify the "timeoutSeconds" value present in the "MaintenanceWindowRunCommandParameters" API, then Delivery Timeout will increase thereby increasing the Total Timeout [Eg:- 800 (DeliveryTimeout) + 3600 (ExecutionTimeout) = 4400 seconds). It will never increase the time for the command to complete (Execution Timeout)]. As soon as long instance is reporting to SSM, then there should be no issues even if server/user is logged out.

2. How, using the CDK do you expose the Execution Timeout? The documentation is not clear how this is implemented within a Maintenance Window Task Invocation.

  • We do not specifically expose Execution Timeout value through the API however you can build your SSM document to include Execution Timeout as a parameter and provide its value through the "MaintenanceWindowRunCommandParameters" API via Parameters syntax.

Example:

"parameters": {
    "executionTimeout": {
      "type": "String",
      "description": "(Optional) The time in seconds for a command to be completed before it is considered to have failed.",
      "allowedPattern": "([1-9][0-9]{0,4})|(1[0-6][0-9]{4})|(17[0-1][0-9]{3})|(172[0-7][0-9]{2})|(172800)"
    }
  },
"mainSteps": [
{
      "action": "aws:runShellScript",
      "name": "Sleep2M",
      "inputs": {
        "runCommand": "{{ commands }}",
        "timeoutSeconds": "{{ executionTimeout }}"
  }
]

The {{ executionTimeout }} parameter value of the document can be provided through "MaintenanceWindowRunCommandParameters" API in the CDK application/code as shown below:

Example:

const TaskInvocationParameters= {
    maintenanceWindowRunCommandParameters: {
        parameters: {
            executionTimeout : ["3000"] <--- Here, you can specify the execution timeout value which will be fed into the document plugin
        },
    },
};
AWS
ENGENHEIRO DE SUPORTE
Aamir_H
respondido há 4 meses
profile picture
ESPECIALISTA
avaliado há 9 dias

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas