import_vm_image
async
¶
import_vm_image(
name: NonEmptyString,
semantic_version: VersionNumber,
platform: Platform,
vm_import_task_id: NonEmptyString,
client_token: ClientToken,
*,
config_overrides: Optional[AsyncimagebuilderClientConfig] = None,
description: Optional[NonEmptyString] = None,
os_version: Optional[OsVersion] = None,
logging_configuration: Optional[ImageLoggingConfiguration] = None,
tags: Optional[TagMap] = None,
) -> ImportVmImageResponse
Creates an Image Builder image resource from an Amazon EC2 VM import task. The response returns as soon as Image Builder creates the image resource in the PENDING state. Image Builder then monitors the import task asynchronously. When the task completes, Image Builder records the AMI that it produced as the new image's output resource and marks the image AVAILABLE. You can then use the imported image as the base image for your recipes.
To create the VM import task, use the Amazon EC2 API ImportImage operation, or the import-image CLI command.
Parameters:
-
name(NonEmptyString) –The name of the base image that is created by the import process. Image Builder generates the image ARN from a normalized form of the name, so names that differ only in case, spaces, or underscores count as the same name. If an image with the same name and semantic version already exists in your account in the same Amazon Web Services Region, the import creates a new build version for it.
-
semantic_version(VersionNumber) –The semantic version to attach to the base image that was created during the import process. This version follows the semantic version syntax.
The semantic version has four nodes:
. . / . 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. The upper limit is 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(Optional[NonEmptyString], default:None) –The description for the base image that is created by the import process.
-
platform(Platform) –The operating system platform for the imported VM.
-
os_version(Optional[OsVersion], default:None) –The operating system version for the imported VM.
-
vm_import_task_id(NonEmptyString) –The
importTaskId(API) orImportTaskId(CLI) from the Amazon EC2 VM import process. The import task doesn't need to be complete when you call ImportVmImage - Image Builder monitors the task and finishes creating the image when the task completes. -
logging_configuration(Optional[ImageLoggingConfiguration], default:None) –The CloudWatch Logs log group where Image Builder sends the import logs. For ImportVmImage, the log group name must be within the
/aws/imagebuilder/namespace. -
tags(Optional[TagMap], default:None) –Tags that are attached to the import resources.
-
client_token(ClientToken) –A unique, case-sensitive identifier you provide to ensure that the operation runs no more than one time. If you retry a request with the same client token, Image Builder returns the original response without running the operation again. For more information, see Ensuring idempotency in the Amazon EC2 API Reference.
Raises:
-
ClientException–A generic client error. This error usually indicates that the request failed a validation check, such as when a downstream service rejects a configured value.
-
ServiceException–An internal server error occurred while Image Builder processed the request. Retrying the request may succeed.
-
ServiceUnavailableException–The service is unable to process your request at this time.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Import a virtual machine as an Image Builder image The following example registers the output of an EC2 VM Import/Export task (import-ami) as a new Image Builder image, so you can use the imported virtual machine as a base image.
>>> await client.import_vm_image(name='my-example-imported-image', semantic_version='1.0.0', platform='Linux', os_version='Amazon Linux 2', vm_import_task_id='import-ami-1234567890abcdef0', client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE00000')
Source code in docs_src/capo_imagebuilder/_services/async_imagebuilder.py
3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 | |