Importing an OMI from a Bucket

You can import an OUTSCALE Machine Image (OMI) that has been previously exported to an S3-compatible bucket to create a copy of it in your account.

This enables you to copy an OMI between accounts that are in different Regions or in the same one. The copy of the OMI belongs to your account, is independent from the source OMI, and gets its own ID. Any snapshot used by the source OMI is also copied to your account.

When importing the OMI, you need to specify one of the following elements for the image location:

The manifest file is obsolete seven days after a completed export as it contains pre-signed URLs to the appropriate snapshots (pre-signed URL are valid for only seven days).

Importing an OMI Using OSC CLI

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: Registering from a bucket by using a manifest file
$ osc-cli api CreateImage --profile "default" \
    --ImageName "register-image-from-bucket-example" \
    --FileLocation "https://oos.eu-west-2.outscale.com/BUCKET/KEY?AWSAccessKeyId=ABCDEFGHIJ0123456789&Expires=1493372309&Signature=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

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.

  • FileLocation: (optional) (when registering from a bucket by using a manifest file) The pre-signed URL of the manifest file for the OMI you want to register. For more information, see Configuring a Pre-signed URL or Managing Access to Your Buckets and Objects.
    You can also specify the normal URL of the OMI if you have permission on the OOS bucket, without using the manifest file, but in that case, you need to manually specify through the other parameters all the information that would otherwise be read from the manifest file.

  • ImageName: (optional) A unique name for the new OMI.
    Constraints: 3-128 alphanumeric characters, underscores (_), spaces (` ), parentheses (()), slashes (/), periods (.), or dashes (-`).

  • ProductCodes: (optional) The product codes associated with the OMI.

The CreateImage command returns the following elements:

  • Image: Information about the OMI.

  • ResponseContext: Information about the context of the response.

Result sample: Registering from a bucket by using a manifest file
{
  "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": "https://oos.eu-west-2.outscale.com/BUCKET/KEY?AWSAccessKeyId=ABCDEFGHIJ0123456789&Expires=1493372309&Signature=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "Architecture": "x86_64",
    "ImageName": "register-image-from-bucket-example"
  }
}

Importing an OMI Using AWS CLI

To import an OMI from a bucket, use the register-image command following this syntax:

Request sample
$ aws ec2 register-image \
    --profile YOUR_PROFILE \
    --name Test Image \
    --description Test \
    --architecture x86_64 \
    --image-location https://oos.eu-west-2.outscale.com/bucket/object?AWSAccessKeyId=A1BC2DE3FGHIJ4LMN567&Expires=1493971940&Signature=%2FR63JOJcFzNGubLEXckKGVIi8kk%3D \
    --root-device-name /dev/sda1 \
    --block-device-mapping YOUR_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.

  • name: The name for the copy of the OMI in your account.

  • (optional) description: A description for the copy of the OMI in your account (if different from the source’s one)

  • (optional) architecture: The architecture for the copy of the OMI in your account (i386 | x86_64). If you do not specify any architecture, it is set to i386 by default.

  • (optional) image-location: The pre-signed URL of the OMI manifest file, or the full path to the OMI in the bucket.

    Note

    • If you specify a pre-signed URL in the image-location attribute, this is the only attribute you need to specify for the command as all the other information are contained in the manifest of the OMI.

    • If you specify a path to a bucket, you need to specify all the other attributes.

  • (optional) root-device-name: The device name for the root device (for example, /dev/sda1).

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

  • 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 copy of the OMI in your account.

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

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.