Modifier un attribut d’une VM
Vous pouvez modifier un attribut d’une machine virtuelle (VM), tel que son type, ses user data ou son paramètre de suppression. Selon l’attribut que vous voulez modifier, la VM doit être en fonctionnement ou à l’arrêt.
Modifier un attribut d’une VM avec Cockpit v2
Avant de commencer :
Pour en savoir plus, voir Arrêter et démarrer des VM et À propos des VM > Les attributs des VM. |
-
Dans le dashboard VMs, cochez la case de la VM dont vous voulez modifier les attributs.
La multisélection est disponible.
La VM est sélectionnée.
-
Placez le curseur de la souris sur Mettre à jour la VM.
Les attributs modifiables apparaissent.
(optionnel) Modifier les security groups associés à la VM
-
Cliquez sur Security Groups.
La boîte de dialogue METTRE À JOUR LES SECURITY GROUPS apparaît. -
Cliquez dans le champ pour faire apparaître la liste des security groups.
Dans la liste, sélectionnez le ou les security group(s) que vous voulez associer à la VM. -
Pour dissocier un security group d’une VM, cliquez sur à côté du nom du security group.
-
Cliquez sur Modifier.
(optionnel) Modifier le type de VM
-
Cliquez sur Type de VM.
La boîte de dialogue METTRE À JOUR LE TYPE DE LA VM apparaît. -
Spécifiez les attributs suivants pour votre VM :
-
Génération du CPU : La génération du processeur.
-
Performance : L’indicateur de performance.
-
Très haute : Capacité de calcul maximum sur tous les vCPU de la VM. Cette valeur est idéale pour les applications de calcul intensif demandant des performances stables durant le cycle de vie de la VM.
-
Haute : Haute capacité de calcul sur tous les vCPU de la VM. Cette valeur s’applique à la plupart des cas et offre des performances variables dans le temps.
-
Moyenne : Performance à variation significative sur tous les vCPU de la VM. Cette valeur ne garantit pas des performances constantes, mais est idéale pour les machines à faible demande CPU.
-
-
Cœur(s) : Le nombre de vCores, jusqu’à 78.
-
Mémoire (Gio) : La quantité de mémoire, jusqu’à 1039 Gio.
Pour en savoir plus sur les types de VM, voir Types de VM.
Pour fonctionner correctement, les VM Windows nécessitent au moins un processeur de génération v3, 2 vCores et 4 Gio de mémoire.
-
-
Cliquez sur Modifier.
(optionnel) Modifier le comportement de la VM à sa coupure
-
Cliquez sur Comportement à la coupure.
La boîte de dialogue METTRE À JOUR LE COMPORTEMENT À LA COUPURE apparaît. -
Dans la liste, sélectionnez une des valeurs suivantes :
-
Arrêter
: Lorsque vous coupez la VM, celle-ci s’arrête. -
Terminer
: Lorsque vous coupez la VM, celle-ci s’arrête et est terminée. -
Redémarrer
: Lorsque vous coupez la VM, celle-ci s’arrête et redémarre automatiquement.Pour en savoir plus, voir À propos du cycle de vie des VM > Suppression.
-
-
Cliquez sur Modifier.
(optionnel) Modifier la protection contre la suppression de la VM
-
Cliquez sur l’onglet Protection contre suppression.
La boîte de dialogue METTRE À JOUR LA PROTECTION CONTRE SUPPRESSION apparaît. -
Activez ou désactivez le bouton :
-
S’il est sur activé, vous ne pouvez pas supprimer la VM.
-
S’il est sur désactivé, vous pouvez la supprimer avec n’importe quelle interface.
-
-
Cliquez sur Modifier.
Modifier un attribut d’une VM avec OSC CLI
Avant de commencer :
Pour en savoir plus, voir Arrêter et démarrer des VM et À propos des VM > Les attributs des VM. |
À ce jour, cette section est disponible en anglais uniquement. |
The UpdateVm command modifies the specified attributes of a virtual machine (VM).
You must stop the VM before modifying the following attributes:
-
NestedVirtualization
-
Performance
-
UserData
-
VmType
$ osc-cli api UpdateVm --profile "default" \
--VmId "i-12345678" \
--VmType "tinav5.c2r2p2"
$ osc-cli api UpdateVm --profile "default" \
--VmId "i-12345678" \
--UserData "$(base64 -i user_data.txt)"
This command contains the following attributes that you need to specify:
-
BlockDeviceMappings
: (optional) One or more block device mappings of the VM.-
Bsu
: (optional) Information about the BSU volume.-
DeleteOnVmDeletion
: (optional) If set to true, the volume is deleted when terminating the VM. If set to false, the volume is not deleted when terminating the VM. -
VolumeId
: (optional) The ID of the volume.
-
-
DeviceName
: (optional) 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
). -
NoDevice
: (optional) Removes the device which is included in the block device mapping of the OMI. -
VirtualDeviceName
: (optional) The name of the virtual device (ephemeralN
).
-
-
BsuOptimized
: (optional) This parameter is not available. It is present in our API for the sake of historical compatibility with AWS. -
DeletionProtection
: (optional) If true, you cannot delete the VM unless you change this parameter back to false. -
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
IsSourceDestChecked
: (optional) (Net only) If true, the source/destination check is enabled. If false, it is disabled. -
KeypairName
: (optional) The name of a keypair you want to associate with the VM.
When you replace the keypair of a VM with another one, the metadata of the VM is modified to reflect the new public key, but the replacement is still not effective in the operating system of the VM. To complete the replacement and effectively apply the new keypair, you need to perform other actions inside the VM. For more information, see Modifying the Keypair of a VM. -
NestedVirtualization
: (optional) (dedicated tenancy only) If true, nested virtualization is enabled. If false, it is disabled. -
Performance
: (optional) The performance of the VM (medium
|high
|highest
). -
SecurityGroupIds
: (optional) One or more IDs of security groups for the VM. -
UserData
: (optional) The Base64-encoded MIME user data, limited to 500 kibibytes (KiB). -
VmId
: The ID of the VM. -
VmInitiatedShutdownBehavior
: (optional) The VM behavior when you stop it. If set tostop
, the VM stops. If set torestart
, the VM stops then automatically restarts. If set toterminate
, the VM stops and is terminated. -
VmType
: (optional) The type of VM. For more information, see VM Types.
The UpdateVm command returns the following elements:
-
ResponseContext
: Information about the context of the response.-
RequestId
: The ID of the request.
-
-
Vm
: Information about the VM.-
Architecture
: The architecture of the VM (i386
|x86_64
). -
BlockDeviceMappings
: The block device mapping of the VM.-
Bsu
: Information about the created BSU volume.-
DeleteOnVmDeletion
: If true, the volume is deleted when terminating the VM. If false, the volume is not deleted when terminating the VM. -
LinkDate
: The date and time (UTC) at which the volume was attached to the VM, in ISO 8601 date-time format. -
State
: The state of the volume. -
VolumeId
: The ID of the volume.
-
-
DeviceName
: The name of the device.
-
-
BsuOptimized
: This parameter is not available. It is present in our API for the sake of historical compatibility with AWS. -
ClientToken
: The idempotency token provided when launching the VM. -
CreationDate
: The date and time (UTC) at which the VM was created. -
DeletionProtection
: If true, you cannot delete the VM unless you change this parameter back to false. -
Hypervisor
: The hypervisor type of the VMs (ovm
|xen
). -
ImageId
: The ID of the OMI used to create the VM. -
IsSourceDestChecked
: (Net only) If true, the source/destination check is enabled. If false, it is disabled. -
KeypairName
: The name of the keypair used when launching the VM. -
LaunchNumber
: The number for the VM when launching a group of several VMs (for example,0
,1
,2
, and so on). -
NestedVirtualization
: If true, nested virtualization is enabled. If false, it is disabled. -
NetId
: The ID of the Net in which the VM is running. -
Nics
: (Net only) The network interface cards (NICs) the VMs are attached to.-
AccountId
: The account ID of the owner of the NIC. -
Description
: The description of the NIC. -
IsSourceDestChecked
: (Net only) If true, the source/destination check is enabled. If false, it is disabled. -
LinkNic
: Information about the network interface card (NIC).-
DeleteOnVmDeletion
: If true, the NIC is deleted when the VM is terminated. -
DeviceNumber
: The device index for the NIC attachment (between1
and7
, both included). -
LinkNicId
: The ID of the NIC to attach. -
State
: The state of the attachment (attaching
|attached
|detaching
|detached
).
-
-
LinkPublicIp
: Information about the public IP associated with the NIC.-
PublicDnsName
: The name of the public DNS. -
PublicIp
: The public IP associated with the NIC. -
PublicIpAccountId
: The account ID of the owner of the public IP.
-
-
MacAddress
: The Media Access Control (MAC) address of the NIC. -
NetId
: The ID of the Net for the NIC. -
NicId
: The ID of the NIC. -
PrivateDnsName
: The name of the private DNS. -
PrivateIps
: The private IP or IPs of the NIC.-
IsPrimary
: If true, the IP is the primary private IP of the NIC. -
LinkPublicIp
: Information about the public IP associated with the NIC.-
PublicDnsName
: The name of the public DNS. -
PublicIp
: The public IP associated with the NIC. -
PublicIpAccountId
: The account ID of the owner of the public IP.
-
-
PrivateDnsName
: The name of the private DNS. -
PrivateIp
: The private IP.
-
-
SecurityGroups
: One or more IDs of security groups for the NIC.-
SecurityGroupId
: The ID of the security group. -
SecurityGroupName
: The name of the security group.
-
-
State
: The state of the NIC (available
|attaching
|in-use
|detaching
). -
SubnetId
: The ID of the Subnet for the NIC.
-
-
OsFamily
: Indicates the operating system (OS) of the VM. -
Performance
: The performance of the VM (medium
|high
|highest
). -
Placement
: Information about the placement of the VM.-
SubregionName
: The name of the Subregion. If you specify this parameter, you must not specify theNics
parameter. -
Tenancy
: The tenancy of the VM (default
,dedicated
, or a dedicated group ID).
-
-
PrivateDnsName
: The name of the private DNS. -
PrivateIp
: The primary private IP of the VM. -
ProductCodes
: The product codes associated with the OMI used to create the VM. -
PublicDnsName
: The name of the public DNS. -
PublicIp
: The public IP of the VM. -
ReservationId
: The reservation ID of the VM. -
RootDeviceName
: The name of the root device for the VM (for example,/dev/sda1
). -
RootDeviceType
: The type of root device used by the VM (alwaysbsu
). -
SecurityGroups
: One or more security groups associated with the VM.-
SecurityGroupId
: The ID of the security group. -
SecurityGroupName
: The name of the security group.
-
-
State
: The state of the VM (pending
|running
|stopping
|stopped
|shutting-down
|terminated
|quarantine
). -
StateReason
: The reason explaining the current state of the VM. -
SubnetId
: The ID of the Subnet for the VM. -
Tags
: One or more tags associated with the VM.-
Key
: The key of the tag, with a minimum of 1 character. -
Value
: The value of the tag, between 0 and 255 characters.
-
-
UserData
: The Base64-encoded MIME user data. -
VmId
: The ID of the VM. -
VmInitiatedShutdownBehavior
: The VM behavior when you stop it. If set tostop
, the VM stops. If set torestart
, the VM stops then automatically restarts. If set toterminate
, the VM stops and is deleted. -
VmType
: The type of VM. For more information, see VM Types.
-
{
"Vm": {
"VmType": "tinav5.c2r2p2",
"VmInitiatedShutdownBehavior": "stop",
"State": "stopped",
"StateReason": "",
"RootDeviceType": "ebs",
"RootDeviceName": "/dev/sda1",
"IsSourceDestChecked": true,
"KeypairName": "keypair-example",
"ImageId": "ami-12345678",
"DeletionProtection": false,
"Architecture": "x86_64",
"NestedVirtualization": false,
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Bsu": {
"VolumeId": "vol-12345678",
"State": "attached",
"LinkDate": "2010-10-01T12:34:56.789Z",
"DeleteOnVmDeletion": true
}
}
],
"VmId": "i-12345678",
"ReservationId": "r-12345678",
"Hypervisor": "xen",
"Placement": {
"Tenancy": "default",
"SubregionName": "eu-west-2a"
},
"ProductCodes": [
"0001"
],
"CreationDate": "2010-10-01T12:34:56.789Z",
"UserData": "",
"SubnetId": "subnet-12345678",
"PrivateIp": "10.0.0.4",
"SecurityGroups": [
{
"SecurityGroupName": "security-group-example",
"SecurityGroupId": "sg-12345678"
}
],
"BsuOptimized": false,
"LaunchNumber": 0,
"NetId": "vpc-12345678",
"Nics": [
{
"SubnetId": "subnet-12345678",
"State": "in-use",
"LinkNic": {
"State": "attached",
"DeviceNumber": 0,
"LinkNicId": "eni-attach-12345678",
"DeleteOnVmDeletion": true
},
"IsSourceDestChecked": true,
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"Description": "Primary network interface",
"AccountId": "123456789012",
"SecurityGroups": [
{
"SecurityGroupName": "security-group-example",
"SecurityGroupId": "sg-12345678"
}
],
"MacAddress": "A1:B2:C3:D4:E5:F6",
"NetId": "vpc-12345678",
"NicId": "eni-12345678",
"PrivateIps": [
{
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"PrivateIp": "10.0.0.4",
"IsPrimary": true
}
]
}
],
"Performance": "high",
"Tags": [
{
"Value": "prod",
"Key": "env"
}
],
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal"
},
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
{
"Vm": {
"VmType": "tinav5.c1r1p2",
"VmInitiatedShutdownBehavior": "stop",
"State": "stopped",
"StateReason": "",
"RootDeviceType": "ebs",
"RootDeviceName": "/dev/sda1",
"IsSourceDestChecked": true,
"KeypairName": "keypair-example",
"ImageId": "ami-12345678",
"DeletionProtection": true,
"Architecture": "x86_64",
"NestedVirtualization": false,
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Bsu": {
"VolumeId": "vol-12345678",
"State": "attached",
"LinkDate": "2010-10-01T12:34:56.789Z",
"DeleteOnVmDeletion": true
}
}
],
"VmId": "i-12345678",
"ReservationId": "r-12345678",
"Hypervisor": "xen",
"Placement": {
"Tenancy": "default",
"SubregionName": "eu-west-2a"
},
"ProductCodes": [
"0001"
],
"CreationDate": "2010-10-01T12:34:56.789Z",
"UserData": "...",
"SubnetId": "subnet-12345678",
"PrivateIp": "10.0.0.4",
"SecurityGroups": [
{
"SecurityGroupName": "security-group-example",
"SecurityGroupId": "sg-12345678"
}
],
"BsuOptimized": false,
"LaunchNumber": 0,
"NetId": "vpc-12345678",
"Nics": [
{
"SubnetId": "subnet-12345678",
"State": "in-use",
"LinkNic": {
"State": "attached",
"DeviceNumber": 0,
"LinkNicId": "eni-attach-12345678",
"DeleteOnVmDeletion": true
},
"IsSourceDestChecked": true,
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"Description": "Primary network interface",
"AccountId": "123456789012",
"SecurityGroups": [
{
"SecurityGroupName": "security-group-example",
"SecurityGroupId": "sg-12345678"
}
],
"MacAddress": "A1:B2:C3:D4:E5:F6",
"NetId": "vpc-12345678",
"NicId": "eni-12345678",
"PrivateIps": [
{
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"PrivateIp": "10.0.0.4",
"IsPrimary": true
}
]
}
],
"Performance": "high",
"Tags": [
{
"Value": "prod",
"Key": "env"
}
],
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal"
},
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Modifier un attribut d’une VM avec oapi-cli
Avant de commencer :
Pour en savoir plus, voir Arrêter et démarrer des VM et À propos des VM > Les attributs des VM. |
À ce jour, cette section est disponible en anglais uniquement. |
The UpdateVm command modifies the specified attributes of a virtual machine (VM).
You must stop the VM before modifying the following attributes:
-
NestedVirtualization
-
Performance
-
UserData
-
VmType
$ oapi-cli --profile "default" UpdateVm \
--VmId "i-12345678" \
--VmType "tinav5.c2r2p2"
$ oapi-cli --profile "default" UpdateVm \
--VmId "i-12345678" \
--UserData "$(base64 -i user_data.txt)"
This command contains the following attributes that you need to specify:
-
BlockDeviceMappings
: (optional) One or more block device mappings of the VM.-
Bsu
: (optional) Information about the BSU volume.-
DeleteOnVmDeletion
: (optional) If set to true, the volume is deleted when terminating the VM. If set to false, the volume is not deleted when terminating the VM. -
VolumeId
: (optional) The ID of the volume.
-
-
DeviceName
: (optional) 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
). -
NoDevice
: (optional) Removes the device which is included in the block device mapping of the OMI. -
VirtualDeviceName
: (optional) The name of the virtual device (ephemeralN
).
-
-
BsuOptimized
: (optional) This parameter is not available. It is present in our API for the sake of historical compatibility with AWS. -
DeletionProtection
: (optional) If true, you cannot delete the VM unless you change this parameter back to false. -
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
IsSourceDestChecked
: (optional) (Net only) If true, the source/destination check is enabled. If false, it is disabled. -
KeypairName
: (optional) The name of a keypair you want to associate with the VM.
When you replace the keypair of a VM with another one, the metadata of the VM is modified to reflect the new public key, but the replacement is still not effective in the operating system of the VM. To complete the replacement and effectively apply the new keypair, you need to perform other actions inside the VM. For more information, see Modifying the Keypair of a VM. -
NestedVirtualization
: (optional) (dedicated tenancy only) If true, nested virtualization is enabled. If false, it is disabled. -
Performance
: (optional) The performance of the VM (medium
|high
|highest
). -
SecurityGroupIds
: (optional) One or more IDs of security groups for the VM. -
UserData
: (optional) The Base64-encoded MIME user data, limited to 500 kibibytes (KiB). -
VmId
: The ID of the VM. -
VmInitiatedShutdownBehavior
: (optional) The VM behavior when you stop it. If set tostop
, the VM stops. If set torestart
, the VM stops then automatically restarts. If set toterminate
, the VM stops and is terminated. -
VmType
: (optional) The type of VM. For more information, see VM Types.
The UpdateVm command returns the following elements:
-
ResponseContext
: Information about the context of the response.-
RequestId
: The ID of the request.
-
-
Vm
: Information about the VM.-
Architecture
: The architecture of the VM (i386
|x86_64
). -
BlockDeviceMappings
: The block device mapping of the VM.-
Bsu
: Information about the created BSU volume.-
DeleteOnVmDeletion
: If true, the volume is deleted when terminating the VM. If false, the volume is not deleted when terminating the VM. -
LinkDate
: The date and time (UTC) at which the volume was attached to the VM, in ISO 8601 date-time format. -
State
: The state of the volume. -
VolumeId
: The ID of the volume.
-
-
DeviceName
: The name of the device.
-
-
BsuOptimized
: This parameter is not available. It is present in our API for the sake of historical compatibility with AWS. -
ClientToken
: The idempotency token provided when launching the VM. -
CreationDate
: The date and time (UTC) at which the VM was created. -
DeletionProtection
: If true, you cannot delete the VM unless you change this parameter back to false. -
Hypervisor
: The hypervisor type of the VMs (ovm
|xen
). -
ImageId
: The ID of the OMI used to create the VM. -
IsSourceDestChecked
: (Net only) If true, the source/destination check is enabled. If false, it is disabled. -
KeypairName
: The name of the keypair used when launching the VM. -
LaunchNumber
: The number for the VM when launching a group of several VMs (for example,0
,1
,2
, and so on). -
NestedVirtualization
: If true, nested virtualization is enabled. If false, it is disabled. -
NetId
: The ID of the Net in which the VM is running. -
Nics
: (Net only) The network interface cards (NICs) the VMs are attached to.-
AccountId
: The account ID of the owner of the NIC. -
Description
: The description of the NIC. -
IsSourceDestChecked
: (Net only) If true, the source/destination check is enabled. If false, it is disabled. -
LinkNic
: Information about the network interface card (NIC).-
DeleteOnVmDeletion
: If true, the NIC is deleted when the VM is terminated. -
DeviceNumber
: The device index for the NIC attachment (between1
and7
, both included). -
LinkNicId
: The ID of the NIC to attach. -
State
: The state of the attachment (attaching
|attached
|detaching
|detached
).
-
-
LinkPublicIp
: Information about the public IP associated with the NIC.-
PublicDnsName
: The name of the public DNS. -
PublicIp
: The public IP associated with the NIC. -
PublicIpAccountId
: The account ID of the owner of the public IP.
-
-
MacAddress
: The Media Access Control (MAC) address of the NIC. -
NetId
: The ID of the Net for the NIC. -
NicId
: The ID of the NIC. -
PrivateDnsName
: The name of the private DNS. -
PrivateIps
: The private IP or IPs of the NIC.-
IsPrimary
: If true, the IP is the primary private IP of the NIC. -
LinkPublicIp
: Information about the public IP associated with the NIC.-
PublicDnsName
: The name of the public DNS. -
PublicIp
: The public IP associated with the NIC. -
PublicIpAccountId
: The account ID of the owner of the public IP.
-
-
PrivateDnsName
: The name of the private DNS. -
PrivateIp
: The private IP.
-
-
SecurityGroups
: One or more IDs of security groups for the NIC.-
SecurityGroupId
: The ID of the security group. -
SecurityGroupName
: The name of the security group.
-
-
State
: The state of the NIC (available
|attaching
|in-use
|detaching
). -
SubnetId
: The ID of the Subnet for the NIC.
-
-
OsFamily
: Indicates the operating system (OS) of the VM. -
Performance
: The performance of the VM (medium
|high
|highest
). -
Placement
: Information about the placement of the VM.-
SubregionName
: The name of the Subregion. If you specify this parameter, you must not specify theNics
parameter. -
Tenancy
: The tenancy of the VM (default
,dedicated
, or a dedicated group ID).
-
-
PrivateDnsName
: The name of the private DNS. -
PrivateIp
: The primary private IP of the VM. -
ProductCodes
: The product codes associated with the OMI used to create the VM. -
PublicDnsName
: The name of the public DNS. -
PublicIp
: The public IP of the VM. -
ReservationId
: The reservation ID of the VM. -
RootDeviceName
: The name of the root device for the VM (for example,/dev/sda1
). -
RootDeviceType
: The type of root device used by the VM (alwaysbsu
). -
SecurityGroups
: One or more security groups associated with the VM.-
SecurityGroupId
: The ID of the security group. -
SecurityGroupName
: The name of the security group.
-
-
State
: The state of the VM (pending
|running
|stopping
|stopped
|shutting-down
|terminated
|quarantine
). -
StateReason
: The reason explaining the current state of the VM. -
SubnetId
: The ID of the Subnet for the VM. -
Tags
: One or more tags associated with the VM.-
Key
: The key of the tag, with a minimum of 1 character. -
Value
: The value of the tag, between 0 and 255 characters.
-
-
UserData
: The Base64-encoded MIME user data. -
VmId
: The ID of the VM. -
VmInitiatedShutdownBehavior
: The VM behavior when you stop it. If set tostop
, the VM stops. If set torestart
, the VM stops then automatically restarts. If set toterminate
, the VM stops and is deleted. -
VmType
: The type of VM. For more information, see VM Types.
-
{
"Vm": {
"VmType": "tinav5.c2r2p2",
"VmInitiatedShutdownBehavior": "stop",
"State": "stopped",
"StateReason": "",
"RootDeviceType": "ebs",
"RootDeviceName": "/dev/sda1",
"IsSourceDestChecked": true,
"KeypairName": "keypair-example",
"ImageId": "ami-12345678",
"DeletionProtection": false,
"Architecture": "x86_64",
"NestedVirtualization": false,
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Bsu": {
"VolumeId": "vol-12345678",
"State": "attached",
"LinkDate": "2010-10-01T12:34:56.789Z",
"DeleteOnVmDeletion": true
}
}
],
"VmId": "i-12345678",
"ReservationId": "r-12345678",
"Hypervisor": "xen",
"Placement": {
"Tenancy": "default",
"SubregionName": "eu-west-2a"
},
"ProductCodes": [
"0001"
],
"CreationDate": "2010-10-01T12:34:56.789Z",
"UserData": "",
"SubnetId": "subnet-12345678",
"PrivateIp": "10.0.0.4",
"SecurityGroups": [
{
"SecurityGroupName": "security-group-example",
"SecurityGroupId": "sg-12345678"
}
],
"BsuOptimized": false,
"LaunchNumber": 0,
"NetId": "vpc-12345678",
"Nics": [
{
"SubnetId": "subnet-12345678",
"State": "in-use",
"LinkNic": {
"State": "attached",
"DeviceNumber": 0,
"LinkNicId": "eni-attach-12345678",
"DeleteOnVmDeletion": true
},
"IsSourceDestChecked": true,
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"Description": "Primary network interface",
"AccountId": "123456789012",
"SecurityGroups": [
{
"SecurityGroupName": "security-group-example",
"SecurityGroupId": "sg-12345678"
}
],
"MacAddress": "A1:B2:C3:D4:E5:F6",
"NetId": "vpc-12345678",
"NicId": "eni-12345678",
"PrivateIps": [
{
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"PrivateIp": "10.0.0.4",
"IsPrimary": true
}
]
}
],
"Performance": "high",
"Tags": [
{
"Value": "prod",
"Key": "env"
}
],
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal"
},
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
{
"Vm": {
"VmType": "tinav5.c1r1p2",
"VmInitiatedShutdownBehavior": "stop",
"State": "stopped",
"StateReason": "",
"RootDeviceType": "ebs",
"RootDeviceName": "/dev/sda1",
"IsSourceDestChecked": true,
"KeypairName": "keypair-example",
"ImageId": "ami-12345678",
"DeletionProtection": true,
"Architecture": "x86_64",
"NestedVirtualization": false,
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Bsu": {
"VolumeId": "vol-12345678",
"State": "attached",
"LinkDate": "2010-10-01T12:34:56.789Z",
"DeleteOnVmDeletion": true
}
}
],
"VmId": "i-12345678",
"ReservationId": "r-12345678",
"Hypervisor": "xen",
"Placement": {
"Tenancy": "default",
"SubregionName": "eu-west-2a"
},
"ProductCodes": [
"0001"
],
"CreationDate": "2010-10-01T12:34:56.789Z",
"UserData": "...",
"SubnetId": "subnet-12345678",
"PrivateIp": "10.0.0.4",
"SecurityGroups": [
{
"SecurityGroupName": "security-group-example",
"SecurityGroupId": "sg-12345678"
}
],
"BsuOptimized": false,
"LaunchNumber": 0,
"NetId": "vpc-12345678",
"Nics": [
{
"SubnetId": "subnet-12345678",
"State": "in-use",
"LinkNic": {
"State": "attached",
"DeviceNumber": 0,
"LinkNicId": "eni-attach-12345678",
"DeleteOnVmDeletion": true
},
"IsSourceDestChecked": true,
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"Description": "Primary network interface",
"AccountId": "123456789012",
"SecurityGroups": [
{
"SecurityGroupName": "security-group-example",
"SecurityGroupId": "sg-12345678"
}
],
"MacAddress": "A1:B2:C3:D4:E5:F6",
"NetId": "vpc-12345678",
"NicId": "eni-12345678",
"PrivateIps": [
{
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
"PrivateIp": "10.0.0.4",
"IsPrimary": true
}
]
}
],
"Performance": "high",
"Tags": [
{
"Value": "prod",
"Key": "env"
}
],
"PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal"
},
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Modifier un attribut d’une instance avec AWS CLI
Avant de commencer :
Pour en savoir plus, voir Arrêter et démarrer des VM et À propos des VM > Les attributs des VM. |
Pour modifier un attribut d’une instance, utilisez la commande modify-instance-attribute en suivant cette syntaxe :
Vous ne pouvez modifier qu’un seul attribut à la fois. |
$ aws ec2 modify-instance-attribute \
--profile YOUR_PROFILE \
--instance-id i-12345678\
--attribute ATTRIBUTE_NAME \
--value ATTRIBUTE_VALUE \
--disable-api-termination \
--block-device-mappings VALUE \
--instance-type m1.large \
--user-data VALUE \
--instance-initiated-shutdown-behavior stop \
--groups sg-12345678 \
--ebs-optimized NOT_SPECIFIED \
--source-dest-check \
--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 dont vous voulez modifier l’attribut. -
(optionnel)
attribute
: Le nom de l’attribut (userData
|rootDeviceName
|instanceType
|groupSet
|ebsOptimized
|sourceDestCheck
|blockDeviceMapping
|disableApiTermination
|instanceInitiatedShutdownBehavior
). -
(optionnel)
value
: La valeur de l’attribut (uniquement pour les attributs suivants :userData
,disableApiTermination
ouinstanceInitiatedShutdownBehavior
). -
(optionnel)
disable-api-termination
: Si paramétré surtrue
, vous ne pouvez pas terminer l’instance, quelle que soit l’interface. Si paramétré surfalse
, vous pouvez. -
(optionnel)
block-device-mappings
: Informations sur les volumes BSU attachés à l’instance. Cet attribut contient les éléments suivants que vous devez spécifier :-
DeviceName
: Le nom de périphérique utilisé pour attacher le volume à l’instance. Pour en savoir plus, voir À propos des volumes.Pour modifier l’attribut
DeleteOnTermination
, cet élément est requis. -
(optionnel)
Ebs
: Informations sur le volume attaché à l’instance. Cet élément contient l’élément suivant que vous devez spécifier :-
(optionnel)
DeleteOnTermination
: Par défaut ou si paramétré surtrue
, le volume est supprimé lorsque l’instance est terminée. Si paramétré surfalse
, il ne l’est pas.Pour modifier l’attribut
block-device-mappings
pour plusieurs volumes en même temps, utilisez la syntaxe suivante :'[{"DeviceName": "/dev/sda1", "Ebs": {"DeleteOnTermination": false}}, {"DeviceName": "/dev/sdb", "Ebs": {"DeleteOnTermination": false}}]'
-
-
-
(optionnel)
instance-type
: Le type d’instance (quantité de vCores, mémoire, stockage). Pour en savoir plus, voir Types de VM.Pour fonctionner correctement, les VMs Windows nécessitent au moins un processeur de génération v3, 2 vCores et 4 Gio de mémoire.
-
(optionnel)
user-data
: De nouvelles user data pour l’instance. Pour en savoir plus, voir Configurer une VM avec les user data et les tags OUTSCALE.Les user data existantes sont effacées et remplacées par celles spécifiées ici.
-
(optionnel)
instance-initiated-shutdown-behavior
: Le comportement lorsque vous coupez l’instance. Par défaut ou si paramétrée surstop
, l’instance s’arrête. Si paramétrée surterminate
, l’instance s’arrête et est terminée. Si paramétrée surrestart
, l’instance s’arrête et redémarre automatiquement. -
(optionnel)
groups
: Un ou plusieurs ID de security groups pour l’instance. -
(optionnel)
source-dest-check|no-source-dest-check
: Si paramétré sursource-dest-check
, la vérification source-destination du trafic réseau est activée. Si paramétré surno-source-dest-check
, elle est désactivée.Vous pouvez modifier l’attribut
sourceDestinationCheck
uniquement si l’instance est dans un VPC. -
(optionnel)
ebs-optimized
: Indique si l’instance est optimisée pour BSU. -
endpoint
: Le endpoint correspondant à la Région à laquelle vous voulez envoyer la requête. Pour en savoir plus, voir Installer et configurer AWS CLI.
L’attribut spécifié est modifié.
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.