Skip to content

get_command_invocation async

get_command_invocation(
    command_id: CommandId,
    instance_id: InstanceId,
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
    plugin_name: Optional[CommandPluginName] = None,
) -> GetCommandInvocationResult

Returns detailed information about command execution for an invocation or plugin. The Run Command API follows an eventual consistency model, due to the distributed nature of the system supporting the API. This means that the result of an API command you run that affects your resources might not be immediately visible to all subsequent commands you run. You should keep this in mind when you carry out an API command that immediately follows a previous API command.

GetCommandInvocation only gives the execution status of a plugin in a document. To get the command execution status on a specific managed node, use ListCommandInvocations. To get the command execution status across managed nodes, use ListCommands.

Parameters:

  • command_id (CommandId) –

    (Required) The parent command ID of the invocation plugin.

  • instance_id (InstanceId) –

    (Required) The ID of the managed node targeted by the command. A managed node can be an Amazon Elastic Compute Cloud (Amazon EC2) instance, edge device, and on-premises server or VM in your hybrid environment that is configured for Amazon Web Services Systems Manager.

  • plugin_name (Optional[CommandPluginName], default: None ) –

    The name of the step for which you want detailed results. If the document contains only one step, you can omit the name and details for that step. If the document contains more than one step, you must specify the name of the step for which you want to view details. Be sure to specify the name of the step, not the name of a plugin like aws:RunShellScript.

    To find the PluginName, check the document content and find the name of the step you want details for. Alternatively, use ListCommandInvocations with the CommandId and Details parameters. The PluginName is the Name attribute of the CommandPlugin object in the CommandPlugins list.

Raises:

  • InternalServerError –

    An error occurred on the server side.

  • InvalidCommandId –

    The specified command ID isn't valid. Verify the ID and try again.

  • InvalidInstanceId –

    The following problems can cause this exception:

    • You don't have permission to access the managed node.

    • Amazon Web Services Systems Manager Agent (SSM Agent) isn't running. Verify that SSM Agent is running.

    • SSM Agent isn't registered with the SSM endpoint. Try reinstalling SSM Agent.

    • The managed node isn't in a valid state. Valid states are: Running, Pending, Stopped, and Stopping. Invalid states are: Shutting-down and Terminated.

  • InvalidPluginName –

    The plugin name isn't valid.

  • InvocationDoesNotExist –

    The command ID and managed node ID you specified didn't match any invocations. Verify the command ID and the managed node ID and try again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_ssm/_services/async_ssm.py
async def get_command_invocation(
    self,
    command_id: "capo_ssm.types.command_id.CommandId",
    instance_id: "capo_ssm.types.instance_id.InstanceId",
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
    plugin_name: Optional[
        "capo_ssm.types.command_plugin_name.CommandPluginName"
    ] = None,
) -> "capo_ssm.types.get_command_invocation_result.GetCommandInvocationResult":
    """<p>Returns detailed information about command execution for an invocation or plugin. The Run Command API follows an eventual consistency model, due to the distributed nature of the system supporting the API. This means that the result of an API command you run that affects your resources might not be immediately visible to all subsequent commands you run. You should keep this in mind when you carry out an API command that immediately follows a previous API command.</p> <p> <code>GetCommandInvocation</code> only gives the execution status of a plugin in a document. To get the command execution status on a specific managed node, use <a>ListCommandInvocations</a>. To get the command execution status across managed nodes, use <a>ListCommands</a>.</p>

    Args:
        command_id: <p>(Required) The parent command ID of the invocation plugin.</p>
        instance_id: <p>(Required) The ID of the managed node targeted by the command. A <i>managed node</i> can be an Amazon Elastic Compute Cloud (Amazon EC2) instance, edge device, and on-premises server or VM in your hybrid environment that is configured for Amazon Web Services Systems Manager.</p>
        plugin_name: <p>The name of the step for which you want detailed results. If the document contains only one step, you can omit the name and details for that step. If the document contains more than one step, you must specify the name of the step for which you want to view details. Be sure to specify the name of the step, not the name of a plugin like <code>aws:RunShellScript</code>.</p> <p>To find the <code>PluginName</code>, check the document content and find the name of the step you want details for. Alternatively, use <a>ListCommandInvocations</a> with the <code>CommandId</code> and <code>Details</code> parameters. The <code>PluginName</code> is the <code>Name</code> attribute of the <code>CommandPlugin</code> object in the <code>CommandPlugins</code> list.</p>

    Raises:
        capo_ssm.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
        capo_ssm.errors.invalid_command_id.InvalidCommandId: <p>The specified command ID isn't valid. Verify the ID and try again.</p>
        capo_ssm.errors.invalid_instance_id.InvalidInstanceId: <p>The following problems can cause this exception:</p> <ul> <li> <p>You don't have permission to access the managed node.</p> </li> <li> <p>Amazon Web Services Systems Manager Agent (SSM Agent) isn't running. Verify that SSM Agent is running.</p> </li> <li> <p>SSM Agent isn't registered with the SSM endpoint. Try reinstalling SSM Agent.</p> </li> <li> <p>The managed node isn't in a valid state. Valid states are: <code>Running</code>, <code>Pending</code>, <code>Stopped</code>, and <code>Stopping</code>. Invalid states are: <code>Shutting-down</code> and <code>Terminated</code>.</p> </li> </ul>
        capo_ssm.errors.invalid_plugin_name.InvalidPluginName: <p>The plugin name isn't valid.</p>
        capo_ssm.errors.invocation_does_not_exist.InvocationDoesNotExist: <p>The command ID and managed node ID you specified didn't match any invocations. Verify the command ID and the managed node ID and try again. </p>
        capo_ssm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ssm.types.get_command_invocation_request.GetCommandInvocationRequest]",
    ) -> AsyncOperationResponse[
        "capo_ssm.types.get_command_invocation_result.GetCommandInvocationResult"
    ]:
        import capo_ssm._operations.amazon_ssm.get_command_invocation

        (
            output,
            http_response,
        ) = await capo_ssm._operations.amazon_ssm.get_command_invocation.async_get_command_invocation(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetCommandInvocation")
    )
    input_: capo_ssm.types.get_command_invocation_request.GetCommandInvocationRequest = {
        "command_id": command_id,
        "instance_id": instance_id,
    }
    if plugin_name is not None:
        input_["plugin_name"] = plugin_name

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output