Creating an OMI from a VM

You can create an OUTSCALE Machine Image (OMI) from a virtual machine (VM). The OMI is created with all data contained in the VM.

This action also creates a snapshot of the root volume of the VM, as well as a snapshot of each BSU volume attached to the VM. For more information, see About OMIs.

Creating an Image from a VM Using Cockpit v2

Before you begin:

  1. If you intend to share the image with other accounts, clean critical information of the VM that you do not want to share:

  2. (Windows VMs only) To reinitialize your Windows VM system, execute the OMI Creation Launcher script in the C:\Windows\Outscale\scripts directory of the VM.

    • This script is only available on VMs created using an official image. If the VM has been created using a non-official image, you can perform a sysprep. For more information, see the official sysprep documentation by Windows.

    • This script enables VMs created using the future image to be reinitialized (ID, keypair, administrator password, and so on).

    The VM automatically stops when the script is done.

You can also do this action in the VMs dashboard, by selecting a VM and clicking IconAddFull Create Image in the displayed action menu.

  1. In the Images dashboard, click IconAddFull Create Image.
    The CREATE IMAGE dialog box appears.

  2. In the Name field, type a name for the image.

    This name must be unique and must contain between 3 and 128 characters. Allowed characters are a-z, A-Z, 0-9, spaces, and [_()/.-].

  3. (optional) In the Description field, type a description for the image.

  4. Select From VM and select a VM from the VM selection list.

    You cannot create an image from a terminated VM.

  5. (optional) To stop the VM before the creation of the image and then reboot it, switch on Reboot VM.

  6. Click Create Image.
    The image is created. The snapshots created for the image appear on the Snapshots dashboard.

Creating an OMI from a VM Using OSC CLI

Before you begin:

  1. If you intend to share the OMI with other accounts, clean critical information of the VM that you do not want to share:

  2. (Windows VMs only) To reinitialize your Windows VM system, execute the OMI Creation Launcher script in the C:\Windows\Outscale\scripts directory of the VM.

    • This script is only available on VMs created using an official OMI. If the VM has been created using a non-official OMI, you can perform a sysprep. For more information, see the official sysprep documentation by Windows.

    • This script enables VMs created using the future OMI to be reinitialized (ID, keypair, administrator password, and so on).

    The VM automatically stops when the script is done.

The CreateImage command creates an OUTSCALE machine image (OMI).
You can use this method in different ways:

  • 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 or Access Control Lists. For more information, see Managing Access to Your Buckets and Objects.

  • Registering from a bucket without using a manifest file: This is similar to the previous case but you manually specify all the information that would be in a manifest file instead of using a manifest file.

Registering from a bucket enables you to copy an OMI across Regions.

For more information, see About OMIs.

Request sample: Creating from a VM
$ 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 (` ), parentheses (()), 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) (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.

  • ResponseContext: Information about the context of the response.

Result sample: Creating from a VM
{
  "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"
  }
}

Creating an OMI from an Instance Using AWS CLI

Before you begin:

  1. If you intend to share the OMI with other accounts, clean critical information of the instance that you do not want to share:

  2. (Windows VMs only) To reinitialize your Windows VM system, execute the OMI Creation Launcher script in the C:\Windows\Outscale\scripts directory of the VM.

    • This script is only available on VMs launched using an official OMI. If the VM has been launched using a non-official OMI, you can perform a sysprep. For more information, see the official sysprep documentation by Windows.

    • This script enables VMs launched using the future OMI to be reinitialized (ID, keypair, administrator password, and so on).

    The VM automatically stops when the script is done.

To create an OMI, use the create-image command following this syntax:

Request sample
$ aws ec2 create-image \
    --profile YOUR_PROFILE \
    --instance-id i-12345678 \
    --name OMI_NAME \
    --description OMI_DESCRIPTION \
    --no-reboot \
    --block-device-mappings BLOCK_DEVICE_MAPPING \
    --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 from which you want to create the OMI.

  • name: The name of the OMI.

    This name must be unique and must contain between 3 and 128 characters. Allowed characters are a-z, A-Z, 0-9, spaces, and [_()/.-].

  • (optional) description: A description for the OMI.

    This description can contain any Unicode character, with no length limit.

  • (optional) reboot | no-reboot: By default or if set to reboot, the instance is stopped before the creation of the OMI, and then is restarted. If set to no-reboot, the instance is not stopped before the creation of the OMI.

  • (optional) block-device-mappings: One or more block device mappings. For more information, see Defining Block Device Mappings.

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

The create-image command returns the following element:

  • ImageId: The ID of the newly created OMI.

Result sample
{
    "ImageId": "ami-12345678"
}

The new OMI is created from the specified instance.

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.