Skip to content

get_console_output

get_console_output(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    instance_id: Optional[InstanceId] = None,
    latest: Optional[Boolean] = None,
    dry_run: Optional[Boolean] = None,
) -> GetConsoleOutputResult

Gets the console output for the specified instance. For Linux instances, the instance console output displays the exact console output that would normally be displayed on a physical monitor attached to a computer. For Windows instances, the instance console output includes the last three system event log errors.

For more information, see Instance console output in the Amazon EC2 User Guide.

Parameters:

  • instance_id (Optional[InstanceId], default: None ) –

    The ID of the instance.

  • latest (Optional[Boolean], default: None ) –

    When enabled, retrieves the latest console output for the instance.

    Default: disabled (false)

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Raises:

Examples:

To get the console output This example gets the console output for the specified instance.

>>> client.get_console_output(instance_id='i-1234567890abcdef0')
Source code in docs_src/capo_ec2/_services/ec2.py
def get_console_output(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    instance_id: Optional["capo_ec2.types.instance_id.InstanceId"] = None,
    latest: Optional["capo_ec2.types.boolean.Boolean"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.get_console_output_result.GetConsoleOutputResult":
    """<p>Gets the console output for the specified instance. For Linux instances, the instance console output displays the exact console output that would normally be displayed on a physical monitor attached to a computer. For Windows instances, the instance console output includes the last three system event log errors.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-console.html#instance-console-console-output">Instance console output</a> in the <i>Amazon EC2 User Guide</i>.</p>

    Args:
        instance_id: <p>The ID of the instance.</p>
        latest: <p>When enabled, retrieves the latest console output for the instance.</p> <p>Default: disabled (<code>false</code>)</p>
        dry_run: <p>Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To get the console output
        This example gets the console output for the specified instance.

        >>> client.get_console_output(instance_id='i-1234567890abcdef0')
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.get_console_output_request.GetConsoleOutputRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.get_console_output_result.GetConsoleOutputResult"
    ]:
        import capo_ec2._operations.amazon_ec2.get_console_output

        output, http_response = (
            capo_ec2._operations.amazon_ec2.get_console_output.get_console_output(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetConsoleOutput")
    )
    input_: capo_ec2.types.get_console_output_request.GetConsoleOutputRequest = {}
    if instance_id is not None:
        input_["instance_id"] = instance_id
    if latest is not None:
        input_["latest"] = latest
    if dry_run is not None:
        input_["dry_run"] = dry_run

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output