Skip to content

update_microvm_image async

update_microvm_image(
    base_image_arn: NonBlankString,
    build_role_arn: RoleArn,
    code_artifact: CodeArtifact,
    image_identifier: MicrovmImageIdentifier,
    *,
    config_overrides: Optional[AsyncLambdaMicrovmsClientConfig] = None,
    base_image_version: Optional[Version] = None,
    description: Optional[str] = None,
    logging: Optional[Logging] = None,
    egress_network_connectors: Optional[NetworkConnectorList] = None,
    cpu_configurations: Optional[CpuConfigurationList] = None,
    resources: Optional[ResourcesList] = None,
    additional_os_capabilities: Optional[CapabilityList] = None,
    hooks: Optional[Hooks] = None,
    environment_variables: Optional[EnvironmentVariableMap] = None,
    kms_key_identifier: Optional[KmsKeyIdentifier] = None,
    client_token: Optional[str] = None,
) -> UpdateMicrovmImageResponse

Updates the configuration of a MicroVM image and triggers a new version build. This operation uses PUT semantics — all required fields (codeArtifact, baseImageArn, buildRoleArn) must be provided with every request.

Parameters:

  • base_image_arn (NonBlankString) –

    The ARN of the base MicroVM image.

  • base_image_version (Optional[Version], default: None ) –

    The specific version of the base MicroVM image to use.

  • build_role_arn (RoleArn) –

    The ARN of the IAM build role.

  • description (Optional[str], default: None ) –

    The description of the MicroVM image.

  • code_artifact (CodeArtifact) –

    The code artifact containing the application code and metadata for the MicroVM image.

  • logging (Optional[Logging], default: None ) –

    The logging configuration for build-time and runtime logs. Specify {"cloudWatch": {"logGroup": "..."}} to stream logs to a custom CloudWatch log group, or {"disabled": {}} to turn off logging.

  • egress_network_connectors (Optional[NetworkConnectorList], default: None ) –

    The list of egress network connectors available to the MicroVM at image build time.

  • cpu_configurations (Optional[CpuConfigurationList], default: None ) –

    The list of supported CPU configurations for the MicroVM.

  • resources (Optional[ResourcesList], default: None ) –

    The resource requirements for the MicroVM.

  • additional_os_capabilities (Optional[CapabilityList], default: None ) –

    Additional OS capabilities granted to the MicroVM runtime environment.

  • environment_variables (Optional[EnvironmentVariableMap], default: None ) –

    Environment variables set in the MicroVM runtime environment.

  • kms_key_identifier (Optional[KmsKeyIdentifier], default: None ) –

    The customer managed Amazon Web Services Key Management Service (Amazon Web Services KMS) key that encrypts the contents and metadata of your MicroVM image version. You must have permission to use the key. Specify the key in one of the following formats:

    • Key ARN

    • Alias ARN

    If you don't specify a key, your MicroVM image version uses an Amazon Web Services owned key.

  • image_identifier (MicrovmImageIdentifier) –

    The unique identifier (ARN or ID) of the MicroVM image to update.

  • client_token (Optional[str], default: None ) –

    A unique, case-sensitive identifier you provide to ensure the idempotency of the request.

Raises:

Source code in docs_src/capo_lambda_microvms/_services/async_lambda_microvms.py
async def update_microvm_image(
    self,
    base_image_arn: "capo_lambda_microvms.types.non_blank_string.NonBlankString",
    build_role_arn: "capo_lambda_microvms.types.role_arn.RoleArn",
    code_artifact: "capo_lambda_microvms.types.code_artifact.CodeArtifact",
    image_identifier: "capo_lambda_microvms.types.microvm_image_identifier.MicrovmImageIdentifier",
    *,
    config_overrides: Optional[AsyncLambdaMicrovmsClientConfig] = None,
    base_image_version: Optional[
        "capo_lambda_microvms.types.version.Version"
    ] = None,
    description: Optional[str] = None,
    logging: Optional["capo_lambda_microvms.types.logging.Logging"] = None,
    egress_network_connectors: Optional[
        "capo_lambda_microvms.types.network_connector_list.NetworkConnectorList"
    ] = None,
    cpu_configurations: Optional[
        "capo_lambda_microvms.types.cpu_configuration_list.CpuConfigurationList"
    ] = None,
    resources: Optional[
        "capo_lambda_microvms.types.resources_list.ResourcesList"
    ] = None,
    additional_os_capabilities: Optional[
        "capo_lambda_microvms.types.capability_list.CapabilityList"
    ] = None,
    hooks: Optional["capo_lambda_microvms.types.hooks.Hooks"] = None,
    environment_variables: Optional[
        "capo_lambda_microvms.types.environment_variable_map.EnvironmentVariableMap"
    ] = None,
    kms_key_identifier: Optional[
        "capo_lambda_microvms.types.kms_key_identifier.KmsKeyIdentifier"
    ] = None,
    client_token: Optional[str] = None,
) -> "capo_lambda_microvms.types.update_microvm_image_response.UpdateMicrovmImageResponse":
    """<p>Updates the configuration of a MicroVM image and triggers a new version build. This operation uses PUT semantics — all required fields (codeArtifact, baseImageArn, buildRoleArn) must be provided with every request.</p>

    Args:
        base_image_arn: <p>The ARN of the base MicroVM image.</p>
        base_image_version: <p>The specific version of the base MicroVM image to use.</p>
        build_role_arn: <p>The ARN of the IAM build role.</p>
        description: <p>The description of the MicroVM image.</p>
        code_artifact: <p>The code artifact containing the application code and metadata for the MicroVM image.</p>
        logging: <p>The logging configuration for build-time and runtime logs. Specify {"cloudWatch": {"logGroup": "..."}} to stream logs to a custom CloudWatch log group, or {"disabled": {}} to turn off logging.</p>
        egress_network_connectors: <p>The list of egress network connectors available to the MicroVM at image build time.</p>
        cpu_configurations: <p>The list of supported CPU configurations for the MicroVM.</p>
        resources: <p>The resource requirements for the MicroVM.</p>
        additional_os_capabilities: <p>Additional OS capabilities granted to the MicroVM runtime environment.</p>
        environment_variables: <p>Environment variables set in the MicroVM runtime environment.</p>
        kms_key_identifier: <p>The customer managed Amazon Web Services Key Management Service (Amazon Web Services KMS) key that encrypts the contents and metadata of your MicroVM image version. You must have permission to use the key. Specify the key in one of the following formats:</p> <ul> <li> <p>Key ARN</p> </li> <li> <p>Alias ARN</p> </li> </ul> <p>If you don't specify a key, your MicroVM image version uses an Amazon Web Services owned key.</p>
        image_identifier: <p>The unique identifier (ARN or ID) of the MicroVM image to update.</p>
        client_token: <p>A unique, case-sensitive identifier you provide to ensure the idempotency of the request.</p>

    Raises:
        capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
        capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
        capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
        capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
        capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_lambda_microvms.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have exceeded a service quota for Lambda MicroVMs.</p>
        capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lambda_microvms.types.update_microvm_image_request.UpdateMicrovmImageRequest]",
    ) -> AsyncOperationResponse[
        "capo_lambda_microvms.types.update_microvm_image_response.UpdateMicrovmImageResponse"
    ]:
        import capo_lambda_microvms._operations.lambda_microvms.update_microvm_image

        (
            output,
            http_response,
        ) = await capo_lambda_microvms._operations.lambda_microvms.update_microvm_image.async_update_microvm_image(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_lambda_microvms.types.update_microvm_image_request.UpdateMicrovmImageRequest",
    ) -> dict[str, Any]:
        import capo_lambda_microvms.types.update_microvm_image_request

        return capo_lambda_microvms.types.update_microvm_image_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_lambda_microvms.types.update_microvm_image_response.UpdateMicrovmImageResponse",
    ) -> dict[str, Any]:
        import capo_lambda_microvms.types.update_microvm_image_response

        return capo_lambda_microvms.types.update_microvm_image_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateMicrovmImage",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_lambda_microvms.types.update_microvm_image_request.UpdateMicrovmImageRequest = {
        "base_image_arn": base_image_arn,
        "build_role_arn": build_role_arn,
        "code_artifact": code_artifact,
        "image_identifier": image_identifier,
    }
    if base_image_version is not None:
        input_["base_image_version"] = base_image_version
    if description is not None:
        input_["description"] = description
    if logging is not None:
        input_["logging"] = logging
    if egress_network_connectors is not None:
        input_["egress_network_connectors"] = egress_network_connectors
    if cpu_configurations is not None:
        input_["cpu_configurations"] = cpu_configurations
    if resources is not None:
        input_["resources"] = resources
    if additional_os_capabilities is not None:
        input_["additional_os_capabilities"] = additional_os_capabilities
    if hooks is not None:
        input_["hooks"] = hooks
    if environment_variables is not None:
        input_["environment_variables"] = environment_variables
    if kms_key_identifier is not None:
        input_["kms_key_identifier"] = kms_key_identifier
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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