There are more AWS SDK examples available in the AWS Doc SDK Examples
Use DescribeImportImageTasks
with a CLI
The following code examples show how to use DescribeImportImageTasks
.
- CLI
-
- AWS CLI
-
To monitor an import image task
The following
describe-import-image-tasks
example checks the status of the specified import image task.aws ec2 describe-import-image-tasks \ --import-task-ids
import-ami-1234567890abcdef0
Output for an import image task that is in progress.
{ "ImportImageTasks": [ { "ImportTaskId": "import-ami-1234567890abcdef0", "Progress": "28", "SnapshotDetails": [ { "DiskImageSize": 705638400.0, "Format": "ova", "Status": "completed", "UserBucket": { "S3Bucket": "my-import-bucket", "S3Key": "vms/my-server-vm.ova" } } ], "Status": "active", "StatusMessage": "converting" } ] }
Output for an import image task that is completed. The ID of the resulting AMI is provided by
ImageId
.{ "ImportImageTasks": [ { "ImportTaskId": "import-ami-1234567890abcdef0", "ImageId": "ami-1234567890abcdef0", "SnapshotDetails": [ { "DiskImageSize": 705638400.0, "Format": "ova", "SnapshotId": "snap-1234567890abcdef0" "Status": "completed", "UserBucket": { "S3Bucket": "my-import-bucket", "S3Key": "vms/my-server-vm.ova" } } ], "Status": "completed" } ] }
-
For API details, see DescribeImportImageTasks
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell
-
Example 1: This example describes the specified image import task.
Get-EC2ImportImageTask -ImportTaskId import-ami-hgfedcba
Output:
Architecture : x86_64 Description : Windows Image 2 Hypervisor : ImageId : ami-1a2b3c4d ImportTaskId : import-ami-hgfedcba LicenseType : AWS Platform : Windows Progress : SnapshotDetails : {/dev/sda1} Status : completed StatusMessage :
Example 2: This example describes all your image import tasks.
Get-EC2ImportImageTask
Output:
Architecture : Description : Windows Image 1 Hypervisor : ImageId : ImportTaskId : import-ami-abcdefgh LicenseType : AWS Platform : Windows Progress : SnapshotDetails : {} Status : deleted StatusMessage : User initiated task cancelation Architecture : x86_64 Description : Windows Image 2 Hypervisor : ImageId : ami-1a2b3c4d ImportTaskId : import-ami-hgfedcba LicenseType : AWS Platform : Windows Progress : SnapshotDetails : {/dev/sda1} Status : completed StatusMessage :
-
For API details, see DescribeImportImageTasks in AWS Tools for PowerShell Cmdlet Reference.
-