D’autres exemples de kits AWS SDK sont disponibles dans le référentiel GitHub AWS Doc SDK Examples
Utilisation de DescribeImportSnapshotTasks avec une CLI
Les exemples de code suivants illustrent comment utiliser DescribeImportSnapshotTasks.
- CLI
-
- AWS CLI
-
Pour surveiller une tâche d’importation d’instantané
L’exemple
describe-import-snapshot-taskssuivant vérifie l’état de la tâche d’importation d’instantané spécifiée.aws ec2 describe-import-snapshot-tasks \ --import-task-idsimport-snap-1234567890abcdef0Sortie pour une tâche d’importation d’instantané en cours.
{ "ImportSnapshotTasks": [ { "Description": "My server VMDK", "ImportTaskId": "import-snap-1234567890abcdef0", "SnapshotTaskDetail": { "Description": "My server VMDK", "DiskImageSize": "705638400.0", "Format": "VMDK", "Progress": "42", "Status": "active", "StatusMessage": "downloading/converting", "UserBucket": { "S3Bucket": "my-import-bucket", "S3Key": "vms/my-server-vm.vmdk" } } } ] }Sortie pour une tâche d’importation d’instantané terminée. L’ID de l’instantané qui en résulte est fourni par
SnapshotId.{ "ImportSnapshotTasks": [ { "Description": "My server VMDK", "ImportTaskId": "import-snap-1234567890abcdef0", "SnapshotTaskDetail": { "Description": "My server VMDK", "DiskImageSize": "705638400.0", "Format": "VMDK", "SnapshotId": "snap-1234567890abcdef0" "Status": "completed", "UserBucket": { "S3Bucket": "my-import-bucket", "S3Key": "vms/my-server-vm.vmdk" } } } ] }-
Pour plus de détails sur l’API, consultez DescribeImportSnapshotTasks
dans la Référence des commandes de l’AWS CLI.
-
- PowerShell
-
- Outils pour PowerShell V4
-
Exemple 1 : cet exemple décrit la tâche d’importation de l’instantané spécifié.
Get-EC2ImportSnapshotTask -ImportTaskId import-snap-abcdefghSortie :
Description ImportTaskId SnapshotTaskDetail ----------------- -------------------- ------------------ Disk Image Import 1 import-snap-abcdefgh Amazon.EC2.Model.SnapshotTaskDetailExemple 2 : cet exemple décrit toutes vos tâches d’importation d’instantanés.
Get-EC2ImportSnapshotTaskSortie :
Description ImportTaskId SnapshotTaskDetail ----------------- -------------------- ------------------ Disk Image Import 1 import-snap-abcdefgh Amazon.EC2.Model.SnapshotTaskDetail Disk Image Import 2 import-snap-hgfedcba Amazon.EC2.Model.SnapshotTaskDetail-
Pour plus de détails sur l’API, consultez DescribeImportSnapshotTasks dans la Référence des applets de commande pour les Outils AWS pour PowerShell (V4).
-
- Outils pour PowerShell V5
-
Exemple 1 : cet exemple décrit la tâche d’importation de l’instantané spécifié.
Get-EC2ImportSnapshotTask -ImportTaskId import-snap-abcdefghSortie :
Description ImportTaskId SnapshotTaskDetail ----------------- -------------------- ------------------ Disk Image Import 1 import-snap-abcdefgh Amazon.EC2.Model.SnapshotTaskDetailExemple 2 : cet exemple décrit toutes vos tâches d’importation d’instantanés.
Get-EC2ImportSnapshotTaskSortie :
Description ImportTaskId SnapshotTaskDetail ----------------- -------------------- ------------------ Disk Image Import 1 import-snap-abcdefgh Amazon.EC2.Model.SnapshotTaskDetail Disk Image Import 2 import-snap-hgfedcba Amazon.EC2.Model.SnapshotTaskDetail-
Pour plus de détails sur l’API, consultez DescribeImportSnapshotTasks dans la Référence des applets de commande pour les Outils AWS pour PowerShell (V5).
-