import_vm_image

import_vm_image(**kwargs)

When you export your virtual machine (VM) from its virtualization environment, that process creates a set of one or more disk container files that act as snapshots of your VM’s environment, settings, and data. The Amazon EC2 API ImportImage action uses those files to import your VM and create an AMI. To import using the CLI command, see import-image

You can reference the task ID from the VM import to pull in the AMI that the import created as the base image for your Image Builder recipe.

See also: AWS API Documentation

Request Syntax

response = client.import_vm_image(
    name='string',
    semanticVersion='string',
    description='string',
    platform='Windows'|'Linux',
    osVersion='string',
    vmImportTaskId='string',
    tags={
        'string': 'string'
    },
    clientToken='string'
)
Parameters
  • name (string) --

    [REQUIRED]

    The name of the base image that is created by the import process.

  • semanticVersion (string) --

    [REQUIRED]

    The semantic version to attach to the base image that was created during the import process. This version follows the semantic version syntax.

    Note

    The semantic version has four nodes: <major>.<minor>.<patch>/<build>. You can assign values for the first three, and can filter on all of them.

    Assignment: For the first three nodes you can assign any positive integer value, including zero, with an upper limit of 2^30-1, or 1073741823 for each node. Image Builder automatically assigns the build number to the fourth node.

    Patterns: You can use any numeric pattern that adheres to the assignment requirements for the nodes that you can assign. For example, you might choose a software version pattern, such as 1.0.0, or a date, such as 2021.01.01.

  • description (string) -- The description for the base image that is created by the import process.
  • platform (string) --

    [REQUIRED]

    The operating system platform for the imported VM.

  • osVersion (string) -- The operating system version for the imported VM.
  • vmImportTaskId (string) --

    [REQUIRED]

    The importTaskId (API) or ImportTaskId (CLI) from the Amazon EC2 VM import process. Image Builder retrieves information from the import process to pull in the AMI that is created from the VM source as the base image for your recipe.

  • tags (dict) --

    Tags that are attached to the import resources.

    • (string) --
      • (string) --
  • clientToken (string) --

    [REQUIRED]

    Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see Ensuring idempotency in the Amazon EC2 API Reference .

    This field is autopopulated if not provided.

Return type

dict

Returns

Response Syntax

{
    'requestId': 'string',
    'imageArn': 'string',
    'clientToken': 'string'
}

Response Structure

  • (dict) --

    • requestId (string) --

      The request ID that uniquely identifies this request.

    • imageArn (string) --

      The Amazon Resource Name (ARN) of the AMI that was created during the VM import process. This AMI is used as the base image for the recipe that imported the VM.

    • clientToken (string) --

      The idempotency token that was used for this request.

Exceptions

  • imagebuilder.Client.exceptions.ServiceException
  • imagebuilder.Client.exceptions.ClientException
  • imagebuilder.Client.exceptions.ServiceUnavailableException