Créer une OMI depuis une VM
Vous pouvez créer une image machine OUTSCALE (OMI) depuis une machine virtuelle (VM). L’OMI créée contient toutes les données contenues dans la VM.
Cette action crée également un snapshot du volume système de la VM, ainsi qu’un snapshot de chaque volume BSU attaché à la VM. Pour en savoir plus, voir À propos des OMI.
Créer une image depuis une VM avec Cockpit v2
Avant de commencer :
|
Vous pouvez également effectuer cette action dans le dashboard VMs, en sélectionnant une VM et en cliquant sur Créer une image dans le menu d’action qui apparaît. |
-
Dans le dashboard Images, cliquez sur Créer une image.
La boîte de dialogue CRÉER UNE IMAGE apparaît. -
Dans le champ Nom, tapez un nom pour l’image.
Ce nom doit être unique et doit contenir entre 3 et 128 caractères. Les caractères autorisés sont a-z, A-Z, 0-9, l’espace et [_()/.-].
-
(optionnel) Dans le champ Description, tapez une description pour l’image.
-
Sélectionnez À partir d’une VM et sélectionnez une VM depuis la liste de sélection VM.
Vous ne pouvez pas créer une image à partir d’une VM terminée.
-
(optionnel) Pour arrêter la VM avant la création de l’image puis la redémarrer, activez Redémarrer la VM.
-
Cliquez sur Créer l’image.
L’image est créée et les snapshots créés pour l’image apparaissent dans le dashboard Snapshots.
Créer une OMI depuis une VM avec OSC CLI
Avant de commencer :
|
À ce jour, cette section est disponible en anglais uniquement. |
The CreateImage command creates an OUTSCALE machine image (OMI).
You can use this method for different use cases:
-
Creating from a VM: You create an OMI from one of your virtual machines (VMs).
-
Copying an OMI: You copy an existing OMI. The source OMI can be one of your own OMIs, or an OMI owned by another account that has granted you permission via the UpdateImage method.
-
Registering from a snapshot: You register an OMI from an existing snapshot. The source snapshot can be one of your own snapshots, or a snapshot owned by another account that has granted you permission via the UpdateSnapshot method.
-
Registering from a bucket by using a manifest file: You register an OMI from the manifest file of an OMI that was exported to an OUTSCALE Object Storage (OOS) bucket. First, the owner of the source OMI must export it to the bucket by using the CreateImageExportTask method. Then, they must grant you permission to read the manifest file via a pre-signed URL. For more information, see Creating a Pre-Signed URL.
Registering from a bucket enables you to copy an OMI across Regions. For more information, see About OMIs. |
$ osc-cli api CreateImage --profile "default" \
--ImageName "create-image-example" \
--VmId "i-12345678" \
--NoReboot True
This command contains the following attributes that you need to specify:
-
Description
: (optional) A description for the new OMI. -
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
ImageName
: (optional) A unique name for the new OMI.
Constraints: 3-128 alphanumeric characters, underscores (_
), spaces (()
), slashes (/
), periods (.
), or dashes (-
). -
NoReboot
: (optional) When creating from a VM: If false, the VM shuts down before creating the OMI and then reboots. If true, the VM does not. -
ProductCodes
: (optional) The product codes associated with the OMI. -
VmId
: (optional) (required) When creating from a VM: The ID of the VM from which you want to create the OMI.
The CreateImage command returns the following elements:
-
Image
: Information about the OMI.-
AccountAlias
: The account alias of the owner of the OMI. -
AccountId
: The account ID of the owner of the OMI. -
Architecture
: The architecture of the OMI. -
BlockDeviceMappings
: One or more block device mappings.-
Bsu
: Information about the BSU volume to create.-
DeleteOnVmDeletion
: By default or if set to true, the volume is deleted when terminating the VM. If false, the volume is not deleted when terminating the VM. -
Iops
: The number of I/O operations per second (IOPS). This parameter must be specified only if you create anio1
volume. The maximum number of IOPS allowed forio1
volumes is13000
with a maximum performance ratio of 300 IOPS per gibibyte. -
SnapshotId
: The ID of the snapshot used to create the volume. -
VolumeSize
: The size of the volume, in gibibytes (GiB).
If you specify a snapshot ID, the volume size must be at least equal to the snapshot size.
If you specify a snapshot ID but no volume size, the volume is created with a size similar to the snapshot one. -
VolumeType
: The type of the volume (standard
|io1
|gp2
). If not specified in the request, astandard
volume is created.
For more information about volume types, see About Volumes > Volume Types and IOPS.
-
-
DeviceName
: The device name for the volume. For a root device, you must use/dev/sda1
. For other volumes, you must use/dev/sdX
,/dev/sdXX
,/dev/xvdX
, or/dev/xvdXX
(where the firstX
is a letter betweenb
andz
, and the secondX
is a letter betweena
andz
). -
VirtualDeviceName
: The name of the virtual device (ephemeralN
).
-
-
CreationDate
: The date and time (UTC) at which the OMI was created. -
Description
: The description of the OMI. -
FileLocation
: The location from which the OMI files were created. -
ImageId
: The ID of the OMI. -
ImageName
: The name of the OMI. -
ImageType
: The type of the OMI. -
PermissionsToLaunch
: Permissions for the resource.-
AccountIds
: One or more account IDs that the permission is associated with. -
GlobalPermission
: A global permission for all accounts.
(Request) Set this parameter to true to make the resource public (if the parent parameter isAdditions
) or to make the resource private (if the parent parameter isRemovals
).
(Response) If true, the resource is public. If false, the resource is private.
-
-
ProductCodes
: The product codes associated with the OMI. -
RootDeviceName
: The name of the root device. -
RootDeviceType
: The type of root device used by the OMI (alwaysbsu
). -
State
: The state of the OMI (pending
|available
|failed
). -
StateComment
: Information about the change of state.-
StateCode
: The code of the change of state. -
StateMessage
: A message explaining the change of state.
-
-
Tags
: One or more tags associated with the OMI.-
Key
: The key of the tag, with a minimum of 1 character. -
Value
: The value of the tag, between 0 and 255 characters.
-
-
-
ResponseContext
: Information about the context of the response.-
RequestId
: The ID of the request.
-
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
},
"Image": {
"StateComment": {},
"State": "pending",
"RootDeviceType": "bsu",
"RootDeviceName": "/dev/sda1",
"ProductCodes": [
"0001"
],
"PermissionsToLaunch": {
"GlobalPermission": false,
"AccountIds": []
},
"AccountId": "123456789012",
"Tags": [],
"Description": "",
"ImageId": "ami-12345678",
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Bsu": {
"VolumeType": "standard",
"DeleteOnVmDeletion": true,
"VolumeSize": 50,
"SnapshotId": "snap-12345678"
}
}
],
"ImageType": "machine",
"CreationDate": "2010-10-01T12:34:56.789Z",
"FileLocation": "123456789012/create-image-example",
"Architecture": "x86_64",
"ImageName": "create-image-example"
}
}
Créer une OMI depuis une VM avec oapi-cli
Avant de commencer :
|
À ce jour, cette section est disponible en anglais uniquement. |
The CreateImage command creates an OUTSCALE machine image (OMI).
You can use this method for different use cases:
-
Creating from a VM: You create an OMI from one of your virtual machines (VMs).
-
Copying an OMI: You copy an existing OMI. The source OMI can be one of your own OMIs, or an OMI owned by another account that has granted you permission via the UpdateImage method.
-
Registering from a snapshot: You register an OMI from an existing snapshot. The source snapshot can be one of your own snapshots, or a snapshot owned by another account that has granted you permission via the UpdateSnapshot method.
-
Registering from a bucket by using a manifest file: You register an OMI from the manifest file of an OMI that was exported to an OUTSCALE Object Storage (OOS) bucket. First, the owner of the source OMI must export it to the bucket by using the CreateImageExportTask method. Then, they must grant you permission to read the manifest file via a pre-signed URL. For more information, see Creating a Pre-Signed URL.
Registering from a bucket enables you to copy an OMI across Regions. For more information, see About OMIs. |
$ oapi-cli --profile "default" CreateImage \
--ImageName "create-image-example" \
--VmId "i-12345678" \
--NoReboot True
This command contains the following attributes that you need to specify:
-
Description
: (optional) A description for the new OMI. -
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
ImageName
: (optional) A unique name for the new OMI.
Constraints: 3-128 alphanumeric characters, underscores (_
), spaces (()
), slashes (/
), periods (.
), or dashes (-
). -
NoReboot
: (optional) When creating from a VM: If false, the VM shuts down before creating the OMI and then reboots. If true, the VM does not. -
ProductCodes
: (optional) The product codes associated with the OMI. -
VmId
: (optional) (required) When creating from a VM: The ID of the VM from which you want to create the OMI.
The CreateImage command returns the following elements:
-
Image
: Information about the OMI.-
AccountAlias
: The account alias of the owner of the OMI. -
AccountId
: The account ID of the owner of the OMI. -
Architecture
: The architecture of the OMI. -
BlockDeviceMappings
: One or more block device mappings.-
Bsu
: Information about the BSU volume to create.-
DeleteOnVmDeletion
: By default or if set to true, the volume is deleted when terminating the VM. If false, the volume is not deleted when terminating the VM. -
Iops
: The number of I/O operations per second (IOPS). This parameter must be specified only if you create anio1
volume. The maximum number of IOPS allowed forio1
volumes is13000
with a maximum performance ratio of 300 IOPS per gibibyte. -
SnapshotId
: The ID of the snapshot used to create the volume. -
VolumeSize
: The size of the volume, in gibibytes (GiB).
If you specify a snapshot ID, the volume size must be at least equal to the snapshot size.
If you specify a snapshot ID but no volume size, the volume is created with a size similar to the snapshot one. -
VolumeType
: The type of the volume (standard
|io1
|gp2
). If not specified in the request, astandard
volume is created.
For more information about volume types, see About Volumes > Volume Types and IOPS.
-
-
DeviceName
: The device name for the volume. For a root device, you must use/dev/sda1
. For other volumes, you must use/dev/sdX
,/dev/sdXX
,/dev/xvdX
, or/dev/xvdXX
(where the firstX
is a letter betweenb
andz
, and the secondX
is a letter betweena
andz
). -
VirtualDeviceName
: The name of the virtual device (ephemeralN
).
-
-
CreationDate
: The date and time (UTC) at which the OMI was created. -
Description
: The description of the OMI. -
FileLocation
: The location from which the OMI files were created. -
ImageId
: The ID of the OMI. -
ImageName
: The name of the OMI. -
ImageType
: The type of the OMI. -
PermissionsToLaunch
: Permissions for the resource.-
AccountIds
: One or more account IDs that the permission is associated with. -
GlobalPermission
: A global permission for all accounts.
(Request) Set this parameter to true to make the resource public (if the parent parameter isAdditions
) or to make the resource private (if the parent parameter isRemovals
).
(Response) If true, the resource is public. If false, the resource is private.
-
-
ProductCodes
: The product codes associated with the OMI. -
RootDeviceName
: The name of the root device. -
RootDeviceType
: The type of root device used by the OMI (alwaysbsu
). -
State
: The state of the OMI (pending
|available
|failed
). -
StateComment
: Information about the change of state.-
StateCode
: The code of the change of state. -
StateMessage
: A message explaining the change of state.
-
-
Tags
: One or more tags associated with the OMI.-
Key
: The key of the tag, with a minimum of 1 character. -
Value
: The value of the tag, between 0 and 255 characters.
-
-
-
ResponseContext
: Information about the context of the response.-
RequestId
: The ID of the request.
-
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
},
"Image": {
"StateComment": {},
"State": "pending",
"RootDeviceType": "bsu",
"RootDeviceName": "/dev/sda1",
"ProductCodes": [
"0001"
],
"PermissionsToLaunch": {
"GlobalPermission": false,
"AccountIds": []
},
"AccountId": "123456789012",
"Tags": [],
"Description": "",
"ImageId": "ami-12345678",
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Bsu": {
"VolumeType": "standard",
"DeleteOnVmDeletion": true,
"VolumeSize": 50,
"SnapshotId": "snap-12345678"
}
}
],
"ImageType": "machine",
"CreationDate": "2010-10-01T12:34:56.789Z",
"FileLocation": "123456789012/create-image-example",
"Architecture": "x86_64",
"ImageName": "create-image-example"
}
}
Créer une OMI depuis une instance avec AWS CLI
Avant de commencer :
|
Pour créer une OMI, utilisez la commande create-image en suivant cette syntaxe :
$ aws ec2 create-image \
--profile YOUR_PROFILE \
--instance-id i-12345678 \
--name OMI_name \
--description "Description of the OMI" \
--no-reboot \
--block-device-mappings BLOCK_DEVICE_MAPPING \
--endpoint https://fcu.eu-west-2.outscale.com
Cette commande contient les attributs suivants que vous devez spécifier :
-
(optionnel)
profile
: Le profil nommé que vous voulez utiliser, créé pendant la configuration d’AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI. -
instance-id
: L’ID de l’instance à partir de laquelle vous souhaitez créer l’OMI. -
name
: Le nom de l’OMI.Ce nom doit être unique et doit contenir entre 3 et 128 caractères. Les caractères autorisés sont a-z, A-Z, 0-9, l’espace et [_()/.-].
-
(optionnel)
description
: Une description pour l’OMI.Cette description peut contenir n’importe quel caractère Unicode, sans limite de longueur.
-
(optionnel)
reboot
|no-reboot
: Par défaut ou si paramétré surreboot
, l’instance est arrêtée avant la création de l’OMI puis redémarrée. Si paramétré surno-reboot
, l’instance n’est pas arrêtée avant la création de l’OMI. -
(optionnel)
block-device-mappings
: Un ou plusieurs block device mappings. Pour en savoir plus, voir Définir des block device mappings. -
endpoint
: Le endpoint correspondant à la Région à laquelle vous voulez envoyer la requête. Pour en savoir plus, voir Installer et configurer AWS CLI.
La commande create-image renvoie les éléments suivants :
{
"ImageId": "ami-12345678"
}
La nouvelle OMI est créée à partir de l’instance spécifiée.
Pages connexes
Méthodes API correspondantes
AWS™ et Amazon Web Services™ sont des marques de commerce d'Amazon Technologies, Inc. ou de ses affiliées aux États-Unis et/ou dans les autres pays.