Creating an OMI from a Snapshot

You can create OUTSCALE machine images (OMIs) from snapshots. With AWS CLI, this action corresponds to registering an OMI and specifying a snapshot ID in its block device mapping.

Creating an OMI From a Snapshot Using Cockpit

Before you begin:

  1. If you intend to share the OMI with other users, clean critical information from the instance:

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

    • This script is only available on instances launched using an official OMI. If the instance 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 instances launched using the future OMI to be reinitialized (ID, keypair, administrator password, and so on).

    The instance automatically stops when the script is done.

  3. Create a snapshot of the root device of the instance from which you want to create the OMI. For more information, see Creating a Snapshot of a Volume.

  1. Click Compute > Outscale Machine Images.

    You can also select a snapshot in the Snapshots page and click Create OMI .

  2. Click Create .
    The CREATE OMI dialog box appears.

  3. In the General section, type:

    • In the Name field, a name for 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) In the Description field, a description for the OMI.

      This description can contain up to 255 Unicode characters.

  4. Check the From snapshot box.

  5. From the top list, select the snapshot you want to create the OMI from.

  6. From the bottom list, select the architecture for the OMI (i386 or x86_64).

  7. Set the Delete on termination option for volumes of instances launched from the OMI:

    • To automatically delete the volumes of an instance you terminate, switch the button to True.

      Data stored on the deleted volumes is lost and cannot be retrieved.

      Before you delete it, ensure you have a backup or snapshot of it. For more information, see Creating a Snapshot of a Volume.

    • To keep the volumes of an instance you terminate, switch the button to False.

  8. Click Create to validate.
    The OMI is created and appears on the Outscale Machine Images page.

Creating an OMI From a Snapshot Using AWS CLI

Before you begin:

  1. If you intend to share the OMI with other users, clean critical information from the instance:

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

    • This script is only available on instances launched using an official OMI. If the instance 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 instances launched using the future OMI to be reinitialized (ID, keypair, administrator password, and so on).

    The instance automatically stops when the script is done.

  3. Create a snapshot of the root device of the instance from which you want to create the OMI. For more information, see Creating a Snapshot of a Volume.

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

Request sample
$ aws ec2 register-image \
    --profile YOUR_PROFILE \
    --name "Test Image" \
    --description "My test image" \
    --architecture x86_64 \
    --root-device-name /dev/sda1 \
    --block-device-mappings "[{\"DeviceName\": \"/dev/sda1\", \
                                \"Ebs\": \
                                        {\"SnapshotId\": \"snap-12345678\"} \
                             }]" \
    --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.

  • 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) architecture: The architecture of the OMI. By default, set to i386 (32-bit architecture).

  • root-device-name: The device name assigned to the root volume.

  • block-device-mappings: The block device mapping indicating the snapshot to use for the root volume. This attribute requires the following elements:

    • DeviceName: The device name assigned to the root volume.

      You must specify the same device name as in the root-device-name attribute.

    • Ebs: Information about the root volume to create. This element requires the following information:

      • SnapshotId: The ID of the snapshot from which you want to create the OMI.

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

The register-image command returns the following element:

  • ImageId: The ID of the newly created OMI.

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

Related Pages

Corresponding API Method

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