Skip to content

create_export_image_task

create_export_image_task(
    *,
    config_overrides: Optional[AppStreamClientConfig] = None,
    image_name: Optional[Name] = None,
    ami_name: Optional[AmiName] = None,
    iam_role_arn: Optional[Arn] = None,
    tag_specifications: Optional[Tags] = None,
    ami_description: Optional[Description] = None,
) -> CreateExportImageTaskResult

Creates a task to export a WorkSpaces Applications image to an EC2 AMI. This allows you to use your customized WorkSpaces Applications images with other AWS services or for backup purposes.

Parameters:

  • image_name (Optional[Name], default: None ) –

    The name of the WorkSpaces Applications image to export. The image must be in an available state and owned by your account.

  • ami_name (Optional[AmiName], default: None ) –

    The name for the exported EC2 AMI. This is a required field that must be unique within your account and region.

  • iam_role_arn (Optional[Arn], default: None ) –

    The ARN of the IAM role that allows WorkSpaces Applications to create the AMI. The role must have permissions to copy images, describe images, and create tags, with a trust relationship allowing appstream.amazonaws.com to assume the role.

  • tag_specifications (Optional[Tags], default: None ) –

    The tags to apply to the exported AMI. These tags help you organize and manage your EC2 AMIs.

  • ami_description (Optional[Description], default: None ) –

    An optional description for the exported AMI. This description will be applied to the resulting EC2 AMI.

Raises:

Source code in docs_src/capo_appstream/_services/app_stream.py
def create_export_image_task(
    self,
    *,
    config_overrides: Optional[AppStreamClientConfig] = None,
    image_name: Optional["capo_appstream.types.name.Name"] = None,
    ami_name: Optional["capo_appstream.types.ami_name.AmiName"] = None,
    iam_role_arn: Optional["capo_appstream.types.arn.Arn"] = None,
    tag_specifications: Optional["capo_appstream.types.tags.Tags"] = None,
    ami_description: Optional[
        "capo_appstream.types.description.Description"
    ] = None,
) -> "capo_appstream.types.create_export_image_task_result.CreateExportImageTaskResult":
    """<p>Creates a task to export a WorkSpaces Applications image to an EC2 AMI. This allows you to use your customized WorkSpaces Applications images with other AWS services or for backup purposes.</p>

    Args:
        image_name: <p>The name of the WorkSpaces Applications image to export. The image must be in an available state and owned by your account.</p>
        ami_name: <p>The name for the exported EC2 AMI. This is a required field that must be unique within your account and region.</p>
        iam_role_arn: <p>The ARN of the IAM role that allows WorkSpaces Applications to create the AMI. The role must have permissions to copy images, describe images, and create tags, with a trust relationship allowing appstream.amazonaws.com to assume the role.</p>
        tag_specifications: <p>The tags to apply to the exported AMI. These tags help you organize and manage your EC2 AMIs.</p>
        ami_description: <p>An optional description for the exported AMI. This description will be applied to the resulting EC2 AMI.</p>

    Raises:
        capo_appstream.errors.concurrent_modification_exception.ConcurrentModificationException: <p>An API error occurred. Wait a few minutes and try again.</p>
        capo_appstream.errors.invalid_account_status_exception.InvalidAccountStatusException: <p>The resource cannot be created because your AWS account is suspended. For assistance, contact AWS Support. </p>
        capo_appstream.errors.invalid_role_exception.InvalidRoleException: <p>The specified role is invalid.</p>
        capo_appstream.errors.limit_exceeded_exception.LimitExceededException: <p>The requested limit exceeds the permitted limit for an account.</p>
        capo_appstream.errors.operation_not_permitted_exception.OperationNotPermittedException: <p>The attempted operation is not permitted.</p>
        capo_appstream.errors.resource_not_available_exception.ResourceNotAvailableException: <p>The specified resource exists and is not in use, but isn't available.</p>
        capo_appstream.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_appstream.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_appstream.types.create_export_image_task_request.CreateExportImageTaskRequest]",
    ) -> OperationResponse[
        "capo_appstream.types.create_export_image_task_result.CreateExportImageTaskResult"
    ]:
        import capo_appstream._operations.photon_admin_proxy_service.create_export_image_task

        output, http_response = (
            capo_appstream._operations.photon_admin_proxy_service.create_export_image_task.create_export_image_task(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateExportImageTask")
    )
    input_: capo_appstream.types.create_export_image_task_request.CreateExportImageTaskRequest = {}
    if image_name is not None:
        input_["image_name"] = image_name
    if ami_name is not None:
        input_["ami_name"] = ami_name
    if iam_role_arn is not None:
        input_["iam_role_arn"] = iam_role_arn
    if tag_specifications is not None:
        input_["tag_specifications"] = tag_specifications
    if ami_description is not None:
        input_["ami_description"] = ami_description

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