Modifying a VM Attribute

You can modify an attribute of a virtual machine (VM), such as its type, user data, or termination behavior. Depending on the attribute you want to modify, the VM must be running or stopped.

Modifying a VM Attribute Using Cockpit v2

Before you begin:

  • To modify the VM Type attribute, you must stop the VM.

  • Other attributes can be modified when the VM is running or stopped.

For more information, see Stopping and Starting VMs and About VMs > VM Attributes.

  1. Click inside the VMs dashboard to make checkboxes appear.

  2. Check the box of the VM whose attributes you want to update.

    Multiselection is available.

    The VM is selected and an action menu appears.

  3. Hover over IconEdit Update VM.
    The attributes available for modification appear.

(optional) Modify the Security Groups Associated with the VM

  1. Click IconSecurityGroup Security Groups.
    The UPDATE SECURITY GROUPS dialog box appears.

  2. Click in the field to make the list of security groups appear.
    From the list, select the security group(s) you want to associate with the VM.

  3. To disassociate a security group from the VM, click IconClose next to the name of the security group.

  4. Click Update Security Group.

(optional) Modify the VM Type

  1. Click the IconEdit VM Type.
    The UPDATE VM TYPE dialog box appears.

  2. Specify the following attributes for your VM:

    • CPU generation: The processor generation.

    • Performance: The performance flag.

      • Highest: Maximum compute capacity on all the cores of the VM. This option is ideal for intensive compute applications that require stable performances during the VM lifecycle.

      • High: High compute capacity on all the cores of the VM. This option offers small performance variability and applies to most cases.

      • Medium: Performance with significant variability on all the cores of the VM. This option does not guarantee consistent performance, but is ideal for machines with low CPU demand.

    • Core(s): The number of vCores, up to 78.

    • Memory (GiB): The amount of memory, up to 1039 GiB.

    For more information about VM types, see VM Types.

    To function properly, Windows VMs require at least a v3 processor generation, 2 vCores, and 4 GiB of memory.

  3. Click Submit.

(optional) Modify the Shutdown Behavior of the VM

  1. Click the IconForceStop Shutdown Behavior.
    The UPDATE SHUTDOWN BEHAVIOR dialog box appears.

  2. From the list, select one of the following values:

    • Stop: When you initiate the shutdown, the VM stops.

    • Terminate: When you initiate the shutdown, the VM stops and is terminated.

    • Restart: When you initiate the shutdown, the VM stops, then automatically restarts.

      For more information, see About VM Lifecycle > Termination.

  3. Click Update Shutdown Behavior.

(optional) Modify the Deletion Protection of the VM

  1. Click the IconDeletionProtection Deletion Protection.
    The UPDATE DELETION PROTECTION dialog box appears.

  2. Switch the button on or off:

    • If on, you cannot delete the VM.

    • If off, you can delete it using any interface.

  3. Click Update Deletion Protection.

Modifying a VM Attribute Using OSC CLI

Before you begin:

  • To modify the VmType, UserData, Performance and NestedVirtualization attributes, you must stop the VM.

  • Other attributes can be modified when the VM is running or stopped.

For more information, see Stopping and Starting VMs and About VMs > VM Attributes.

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

Request sample
$ osc-cli api UpdateVm --profile "default" \
    --VmId "i-12345678" \
    --VmType "tinav5.c2r2p2"
Request sample
$ osc-cli api UpdateVm --profile "default" \
    --VmId "i-12345678" \
    --UserData "..."

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 first X is a letter between b and z, and the second X is a letter between a and z).

    • 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 to stop, the VM stops. If set to restart, the VM stops then automatically restarts. If set to terminate, 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 (between 1 and 7, 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 the Nics 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 (always bsu).

    • 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 to stop, the VM stops. If set to restart, the VM stops then automatically restarts. If set to terminate, the VM stops and is deleted.

    • VmType: The type of VM. For more information, see VM Types.

Result sample
{
  "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"
  }
}
Result sample
{
  "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"
  }
}

Modifying an Instance Attribute Using AWS CLI

Before you begin:

  • To modify the instance-type and user-data attributes, you must stop the instance.

  • Other attributes can be modified when the instance is running or stopped.

For more information, see Stopping and Starting VMs and About VMs > VM Attributes.

To modify an instance attribute, use the modify-instance-attribute command following this syntax:

You can modify only one attribute at a time.

Request sample
$ 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 ATTRIBUTE_VALUE \
    --groups sg-12345678 \
    --source-dest-check \
    --ebs-optimized NOT_SPECIFIED \
    --endpoint https://fcu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • instance-id: The ID of the instance whose attribute you want to modify.

  • (optional) attribute: The name of the attribute (userData | rootDeviceName | instanceType | groupSet | ebsOptimized | sourceDestCheck | blockDeviceMapping | disableApiTermination | instanceInitiatedShutdownBehavior).

  • (optional) value: The value of the attribute (only for the following attributes: userData, disableApiTermination, or instanceInitiatedShutdownBehavior).

  • (optional) disable-api-termination: If true, you cannot terminate the instance, whatever the interface is. If false, you can.

  • (optional) block-device-mappings: Information about BSU volumes attached to the instance. This attribute contains the following elements that you need to specify:

  • (optional) Ebs: Information about the volume attached to the instance. This element contains the following element that you need to specify:

    • (optional) DeleteOnTermination: By default or if set to true, the volume is deleted when the instance is terminated. If set to false, it is not.

      To modify the block-device-mappings attribute for several volumes at the same time, use the following syntax:

      '[{"DeviceName": "/dev/sda1", "Ebs": {"DeleteOnTermination": false}}, {"DeviceName": "/dev/sdb", "Ebs": {"DeleteOnTermination": false}}]'
  • (optional) instance-type: The type of instance (amount of vCores, memory, storage). For more information about instance types, see VM Types.

    To function properly, Windows VMs require at least a v3 processor generation, 2 vCores, and 4 GiB of memory.

  • (optional) user-data: New user data for the instance. For more information, see Configuring a VM with User Data and OUTSCALE Tags.

    Existing user data is erased and replaced by the one you specify here.

    AWS CLI then encodes this user data to Base64. The maximum size for the Base64-encoded user data is 500 kibibytes (KiB).

  • (optional) instance-initiated-shutdown-behavior: The behavior when you initiate the shutdown of the instance. By default or if set to stop, the instance stops. If set to terminate, the instance stops and is terminated. If set to restart, the instance stops, then automatically restarts.

  • (optional) groups: One or more security groups IDs for the instance.

  • (optional) source-dest-check|no-source-dest-check: If set to source-dest-check, source/destination check of network traffic is enabled. If set to no-source-dest-check, it is disabled.

    You can modify the sourceDestCheck attribute only if the instance is in a VPC.

  • (optional) ebs-optimized: Whether the instance is BSU-optimized.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The specified attribute is modified.

Related Pages

Corresponding API Methods

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.