Skip to content

create_imported_image

create_imported_image(
    *,
    config_overrides: Optional[AppStreamClientConfig] = None,
    name: Optional[Name] = None,
    source_ami_id: Optional[PhotonAmiId] = None,
    workspace_image_id: Optional[WorkspaceImageId] = None,
    iam_role_arn: Optional[Arn] = None,
    description: Optional[ImageImportDescription] = None,
    display_name: Optional[ImageImportDisplayName] = None,
    tags: Optional[Tags] = None,
    runtime_validation_config: Optional[RuntimeValidationConfig] = None,
    agent_software_version: Optional[AgentSoftwareVersion] = None,
    app_catalog_config: Optional[AppCatalogConfig] = None,
    dry_run: Optional[Boolean] = None,
) -> CreateImportedImageResult

Creates a custom WorkSpaces Applications image by importing an EC2 AMI. This allows you to use your own customized AMI to create WorkSpaces Applications images that support additional instance types beyond the standard stream.* instances.

Parameters:

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

    A unique name for the imported image. The name must be between 1 and 100 characters and can contain letters, numbers, underscores, periods, and hyphens.

  • source_ami_id (Optional[PhotonAmiId], default: None ) –

    The ID of the EC2 AMI to import.

  • workspace_image_id (Optional[WorkspaceImageId], default: None ) –

    The ID of the Workspaces Image to import.

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

    The ARN of the IAM role that allows WorkSpaces Applications to access your AMI. The role must have permissions to modify image attributes and describe images, with a trust relationship allowing appstream.amazonaws.com to assume the role.

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

    An optional description for the imported image. The description must match approved regex patterns and can be up to 256 characters.

  • display_name (Optional[ImageImportDisplayName], default: None ) –

    An optional display name for the imported image. The display name must match approved regex patterns and can be up to 100 characters.

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

    The tags to apply to the imported image. Tags help you organize and manage your WorkSpaces Applications resources.

  • runtime_validation_config (Optional[RuntimeValidationConfig], default: None ) –

    Configuration for runtime validation of the imported image. When specified, WorkSpaces Applications provisions an instance to test streaming functionality, which helps ensure the image is suitable for use.

  • agent_software_version (Optional[AgentSoftwareVersion], default: None ) –

    The version of the WorkSpaces Applications agent to use for the imported image. Choose CURRENT_LATEST to use the agent version available at the time of import, or ALWAYS_LATEST to automatically update to the latest agent version when new versions are released.

  • app_catalog_config (Optional[AppCatalogConfig], default: None ) –

    Configuration for the application catalog of the imported image. This allows you to specify applications available for streaming, including their paths, icons, and launch parameters. This field contains sensitive data.

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

    When set to true, performs validation checks without actually creating the imported image. Use this to verify your configuration before executing the actual import operation.

Raises:

Source code in docs_src/capo_appstream/_services/app_stream.py
def create_imported_image(
    self,
    *,
    config_overrides: Optional[AppStreamClientConfig] = None,
    name: Optional["capo_appstream.types.name.Name"] = None,
    source_ami_id: Optional[
        "capo_appstream.types.photon_ami_id.PhotonAmiId"
    ] = None,
    workspace_image_id: Optional[
        "capo_appstream.types.workspace_image_id.WorkspaceImageId"
    ] = None,
    iam_role_arn: Optional["capo_appstream.types.arn.Arn"] = None,
    description: Optional[
        "capo_appstream.types.image_import_description.ImageImportDescription"
    ] = None,
    display_name: Optional[
        "capo_appstream.types.image_import_display_name.ImageImportDisplayName"
    ] = None,
    tags: Optional["capo_appstream.types.tags.Tags"] = None,
    runtime_validation_config: Optional[
        "capo_appstream.types.runtime_validation_config.RuntimeValidationConfig"
    ] = None,
    agent_software_version: Optional[
        "capo_appstream.types.agent_software_version.AgentSoftwareVersion"
    ] = None,
    app_catalog_config: Optional[
        "capo_appstream.types.app_catalog_config.AppCatalogConfig"
    ] = None,
    dry_run: Optional["capo_appstream.types.boolean.Boolean"] = None,
) -> "capo_appstream.types.create_imported_image_result.CreateImportedImageResult":
    """<p>Creates a custom WorkSpaces Applications image by importing an EC2 AMI. This allows you to use your own customized AMI to create WorkSpaces Applications images that support additional instance types beyond the standard stream.* instances.</p>

    Args:
        name: <p>A unique name for the imported image. The name must be between 1 and 100 characters and can contain letters, numbers, underscores, periods, and hyphens.</p>
        source_ami_id: <p>The ID of the EC2 AMI to import.</p>
        workspace_image_id: <p>The ID of the Workspaces Image to import.</p>
        iam_role_arn: <p>The ARN of the IAM role that allows WorkSpaces Applications to access your AMI. The role must have permissions to modify image attributes and describe images, with a trust relationship allowing appstream.amazonaws.com to assume the role.</p>
        description: <p>An optional description for the imported image. The description must match approved regex patterns and can be up to 256 characters.</p>
        display_name: <p>An optional display name for the imported image. The display name must match approved regex patterns and can be up to 100 characters.</p>
        tags: <p>The tags to apply to the imported image. Tags help you organize and manage your WorkSpaces Applications resources.</p>
        runtime_validation_config: <p>Configuration for runtime validation of the imported image. When specified, WorkSpaces Applications provisions an instance to test streaming functionality, which helps ensure the image is suitable for use.</p>
        agent_software_version: <p>The version of the WorkSpaces Applications agent to use for the imported image. Choose CURRENT_LATEST to use the agent version available at the time of import, or ALWAYS_LATEST to automatically update to the latest agent version when new versions are released.</p>
        app_catalog_config: <p>Configuration for the application catalog of the imported image. This allows you to specify applications available for streaming, including their paths, icons, and launch parameters. This field contains sensitive data.</p>
        dry_run: <p>When set to true, performs validation checks without actually creating the imported image. Use this to verify your configuration before executing the actual import operation.</p>

    Raises:
        capo_appstream.errors.dry_run_operation_exception.DryRunOperationException: <p>The exception that is thrown when a dry run operation is requested. This indicates that the validation checks have been performed successfully, but no actual resources were created or modified.</p>
        capo_appstream.errors.incompatible_image_exception.IncompatibleImageException: <p>The image can't be updated because it's not compatible for updates.</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_parameter_combination_exception.InvalidParameterCombinationException: <p>Indicates an incorrect combination of parameters, or a missing parameter.</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_already_exists_exception.ResourceAlreadyExistsException: <p>The specified resource already exists.</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_imported_image_request.CreateImportedImageRequest]",
    ) -> OperationResponse[
        "capo_appstream.types.create_imported_image_result.CreateImportedImageResult"
    ]:
        import capo_appstream._operations.photon_admin_proxy_service.create_imported_image

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

    def _redact_input(
        input_: "capo_appstream.types.create_imported_image_request.CreateImportedImageRequest",
    ) -> dict[str, Any]:
        import capo_appstream.types.create_imported_image_request

        return capo_appstream.types.create_imported_image_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateImportedImage", redact_input=_redact_input),
    )
    input_: capo_appstream.types.create_imported_image_request.CreateImportedImageRequest = {}
    if name is not None:
        input_["name"] = name
    if source_ami_id is not None:
        input_["source_ami_id"] = source_ami_id
    if workspace_image_id is not None:
        input_["workspace_image_id"] = workspace_image_id
    if iam_role_arn is not None:
        input_["iam_role_arn"] = iam_role_arn
    if description is not None:
        input_["description"] = description
    if display_name is not None:
        input_["display_name"] = display_name
    if tags is not None:
        input_["tags"] = tags
    if runtime_validation_config is not None:
        input_["runtime_validation_config"] = runtime_validation_config
    if agent_software_version is not None:
        input_["agent_software_version"] = agent_software_version
    if app_catalog_config is not None:
        input_["app_catalog_config"] = app_catalog_config
    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