Skip to content

get_deployable_patch_snapshot_for_instance

get_deployable_patch_snapshot_for_instance(
    instance_id: InstanceId,
    snapshot_id: SnapshotId,
    *,
    config_overrides: Optional[SSMClientConfig] = None,
    baseline_override: Optional[BaselineOverride] = None,
    use_s3_dual_stack_endpoint: Optional[Boolean] = None,
) -> GetDeployablePatchSnapshotForInstanceResult

Retrieves the current snapshot for the patch baseline the managed node uses. This API is primarily used by the AWS-RunPatchBaseline Systems Manager document (SSM document).

If you run the command locally, such as with the Command Line Interface (CLI), the system attempts to use your local Amazon Web Services credentials and the operation fails. To avoid this, you can run the command in the Amazon Web Services Systems Manager console. Use Run Command, a tool in Amazon Web Services Systems Manager, with an SSM document that enables you to target a managed node with a script or command. For example, run the command using the AWS-RunShellScript document or the AWS-RunPowerShellScript document.

Parameters:

  • instance_id (InstanceId) –

    The ID of the managed node for which the appropriate patch snapshot should be retrieved.

  • snapshot_id (SnapshotId) –

    The snapshot ID provided by the user when running AWS-RunPatchBaseline.

  • baseline_override (Optional[BaselineOverride], default: None ) –

    Defines the basic information about a patch baseline override.

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

    Specifies whether to use S3 dualstack endpoints for the patch snapshot download URL. Set to true to receive a presigned URL that supports both IPv4 and IPv6 connectivity. Set to false to use standard IPv4-only endpoints. Default is false. This parameter is required for managed nodes in IPv6-only environments.

Raises:

Source code in docs_src/capo_ssm/_services/ssm.py
def get_deployable_patch_snapshot_for_instance(
    self,
    instance_id: "capo_ssm.types.instance_id.InstanceId",
    snapshot_id: "capo_ssm.types.snapshot_id.SnapshotId",
    *,
    config_overrides: Optional[SSMClientConfig] = None,
    baseline_override: Optional[
        "capo_ssm.types.baseline_override.BaselineOverride"
    ] = None,
    use_s3_dual_stack_endpoint: Optional["capo_ssm.types.boolean.Boolean"] = None,
) -> "capo_ssm.types.get_deployable_patch_snapshot_for_instance_result.GetDeployablePatchSnapshotForInstanceResult":
    """<p>Retrieves the current snapshot for the patch baseline the managed node uses. This API is primarily used by the <code>AWS-RunPatchBaseline</code> Systems Manager document (SSM document).</p> <note> <p>If you run the command locally, such as with the Command Line Interface (CLI), the system attempts to use your local Amazon Web Services credentials and the operation fails. To avoid this, you can run the command in the Amazon Web Services Systems Manager console. Use Run Command, a tool in Amazon Web Services Systems Manager, with an SSM document that enables you to target a managed node with a script or command. For example, run the command using the <code>AWS-RunShellScript</code> document or the <code>AWS-RunPowerShellScript</code> document.</p> </note>

    Args:
        instance_id: <p>The ID of the managed node for which the appropriate patch snapshot should be retrieved.</p>
        snapshot_id: <p>The snapshot ID provided by the user when running <code>AWS-RunPatchBaseline</code>.</p>
        baseline_override: <p>Defines the basic information about a patch baseline override.</p>
        use_s3_dual_stack_endpoint: <p>Specifies whether to use S3 dualstack endpoints for the patch snapshot download URL. Set to <code>true</code> to receive a presigned URL that supports both IPv4 and IPv6 connectivity. Set to <code>false</code> to use standard IPv4-only endpoints. Default is <code>false</code>. This parameter is required for managed nodes in IPv6-only environments. </p>

    Raises:
        capo_ssm.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
        capo_ssm.errors.unsupported_feature_required_exception.UnsupportedFeatureRequiredException: <p>Patching for applications released by Microsoft is only available on EC2 instances and advanced instances. To patch applications released by Microsoft on on-premises servers and VMs, you must enable advanced instances. For more information, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-managedinstances-advanced.html">Turning on the advanced-instances tier</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
        capo_ssm.errors.unsupported_operating_system.UnsupportedOperatingSystem: <p>The operating systems you specified isn't supported, or the operation isn't supported for the operating system.</p>
        capo_ssm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ssm.types.get_deployable_patch_snapshot_for_instance_request.GetDeployablePatchSnapshotForInstanceRequest]",
    ) -> OperationResponse[
        "capo_ssm.types.get_deployable_patch_snapshot_for_instance_result.GetDeployablePatchSnapshotForInstanceResult"
    ]:
        import capo_ssm._operations.amazon_ssm.get_deployable_patch_snapshot_for_instance

        output, http_response = (
            capo_ssm._operations.amazon_ssm.get_deployable_patch_snapshot_for_instance.get_deployable_patch_snapshot_for_instance(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_ssm.types.get_deployable_patch_snapshot_for_instance_request.GetDeployablePatchSnapshotForInstanceRequest",
    ) -> dict[str, Any]:
        import capo_ssm.types.get_deployable_patch_snapshot_for_instance_request

        return capo_ssm.types.get_deployable_patch_snapshot_for_instance_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "GetDeployablePatchSnapshotForInstance", redact_input=_redact_input
        ),
    )
    input_: capo_ssm.types.get_deployable_patch_snapshot_for_instance_request.GetDeployablePatchSnapshotForInstanceRequest = {
        "instance_id": instance_id,
        "snapshot_id": snapshot_id,
    }
    if baseline_override is not None:
        input_["baseline_override"] = baseline_override
    if use_s3_dual_stack_endpoint is not None:
        input_["use_s3_dual_stack_endpoint"] = use_s3_dual_stack_endpoint

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