ImportVmImage - EC2 Image Builder

ImportVmImage

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 AWS 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.

Request Syntax

PUT /ImportVmImage HTTP/1.1 Content-type: application/json { "clientToken": "string", "description": "string", "name": "string", "osVersion": "string", "platform": "string", "semanticVersion": "string", "tags": { "string" : "string" }, "vmImportTaskId": "string" }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

clientToken

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

Type: String

Length Constraints: Minimum length of 1. Maximum length of 36.

Required: Yes

description

The description for the base image that is created by the import process.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

name

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

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: Yes

osVersion

The operating system version for the imported VM.

Type: String

Length Constraints: Minimum length of 1.

Required: No

platform

The operating system platform for the imported VM.

Type: String

Valid Values: Windows | Linux

Required: Yes

semanticVersion

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.

Type: String

Pattern: ^[0-9]+\.[0-9]+\.[0-9]+$

Required: Yes

tags

Tags that are attached to the import resources.

Type: String to string map

Map Entries: Maximum number of 50 items.

Key Length Constraints: Minimum length of 1. Maximum length of 128.

Key Pattern: ^(?!aws:)[a-zA-Z+-=._:/]+$

Value Length Constraints: Maximum length of 256.

Required: No

vmImportTaskId

The importTaskId (API) or ImportTaskId (AWS 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.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: Yes

Response Syntax

HTTP/1.1 200 Content-type: application/json { "clientToken": "string", "imageArn": "string", "requestId": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

clientToken

The client token that uniquely identifies the request.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 36.

imageArn

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.

Type: String

requestId

The request ID that uniquely identifies this request.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Errors

For information about the errors that are common to all actions, see Common Errors.

ClientException

These errors are usually caused by a client action, such as using an action or resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying an invalid resource identifier.

HTTP Status Code: 400

ServiceException

This exception is thrown when the service encounters an unrecoverable exception.

HTTP Status Code: 500

ServiceUnavailableException

The service is unable to process your request at this time.

HTTP Status Code: 503

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: