Create a Machine Image
/machineimage/
After adding a machine image, you can use the machine image to create a bootable storage volume. See Create a Storage Volume.
You can also add the machine image to an image list. See Adding a Machine Image.
Note: Before performing this task, you must upload your machine image file to Oracle Cloud Infrastructure Object Storage Classic. Make a note of the name of the .tar.gz
file that you have uploaded. You'll need to provide this name while adding a machine image to Compute Classic.
For more information, see Uploading Machine Image Files to Oracle Cloud Infrastructure Object Storage Classic in Using Oracle Cloud Infrastructure Compute Classic.
Prerequisite: Ensure that you have selected a replication policy for your Oracle Cloud Infrastructure Object Storage Classic instance. See Selecting a Replication Policy for Your Service Instance in Using Oracle Cloud Infrastructure Object Storage Classic.
Required Role: To complete this task, you must have the Compute_Operations
role. If this role isn't assigned to you or you're not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud My Services. See Modifying User Roles in Managing and Monitoring Oracle Cloud.
Request
- application/oracle-compute-v3+json
-
Cookie: string
The Cookie: header must be included with every request to the service. It must be set to the value of the set-cookie header in the response received to the POST /authenticate/ call.
object
-
account:
string
Two-part name of the account (
/Compute-identity_domain/cloud_storage
that contains the credentials and access details of the associated Oracle Cloud Infrastructure Object Storage Classic instance. -
attributes(optional):
object attributes
Additional Properties Allowed: additionalProperties
An optional JSON object or dictionary of arbitrary attributes to be made available to the instance. These are user-defined tags. After defining attributes, you can view them from within an instance at http://192.0.0.192/. See Retrieving User-Defined Instance Attributes in Using Oracle Cloud Infrastructure Compute Classic.
-
description(optional):
string
Arbitrary text describing the image.
-
file(optional):
string
image_file.tar.gz
, whereimage_file
is the .tar.gz name of the machine image file that you have uploaded to Oracle Cloud Infrastructure Object Storage Classic. See Uploading Machine Image Files to Oracle Cloud Infrastructure Object Storage Classic in Using Oracle Cloud Infrastructure Compute Classic. -
name:
string
The three-part name of the object (
/Compute-identity_domain/user/object
).Object names can contain only alphanumeric characters, hyphens, underscores, and periods. Object names are case-sensitive.
-
no_upload(optional):
boolean
Set this to
true
. Indicates that the image file is available in Oracle Cloud Storage Service.
object
An optional JSON object or dictionary of arbitrary attributes to be made available to the instance. These are user-defined tags. After defining attributes, you can view them from within an instance at http://192.0.0.192/. See Retrieving User-Defined Instance Attributes in Using Oracle Cloud Infrastructure Compute Classic.
object
Response
- application/oracle-compute-v3+json
201 Response
-
set-cookie: string
The cookie value is returned if the session is extended
object
-
account(optional):
string
Two-part name of the account (
/Compute-identity_domain/cloud_storage
that contains the credentials and access details of the associated Oracle Cloud Infrastructure Object Storage Classic instance. -
attributes(optional):
object attributes
Additional Properties Allowed: additionalProperties
An optional JSON object or dictionary of arbitrary attributes to be made available to the instance. These are user-defined tags. After defining attributes, you can view them from within an instance at http://192.0.0.192/. See Retrieving User-Defined Instance Attributes in Using Oracle Cloud Infrastructure Compute Classic.
-
audited(optional):
string
Last time when this image was audited
-
checksums(optional):
object checksums
Additional Properties Allowed: additionalPropertiesNot used
-
description(optional):
string
Arbitrary text describing the image.
-
error_reason(optional):
string
Description of the state of the machine image if there is an error.
-
file(optional):
string
Name of the machine image file.
-
hypervisor(optional):
object hypervisor
Additional Properties Allowed: additionalPropertiesA dictionary of hypervisor-specific attributes.
-
image_format(optional):
string
The format of the image.
-
name(optional):
string
The three-part name of the object.
-
no_upload(optional):
boolean
true
indicates that the image file is available in Oracle Cloud Storage Service. -
platform(optional):
string
The OS platform of the image.
-
quota(optional):
string
Not used
-
signature(optional):
string
Not used
-
signed_by(optional):
string
Not used
-
sizes(optional):
object sizes
Size values of the image file.
-
state(optional):
string
The state of the uploaded machine image.
-
uri(optional):
string
Uniform Resource Identifier
object
An optional JSON object or dictionary of arbitrary attributes to be made available to the instance. These are user-defined tags. After defining attributes, you can view them from within an instance at http://192.0.0.192/. See Retrieving User-Defined Instance Attributes in Using Oracle Cloud Infrastructure Compute Classic.
object
object
object
object
object
Examples
cURL Command
The following example shows how to create a machine image by submitting a POST request on the REST resource using cURL. For more information about cURL, see Use cURL.
Enter the command on a single line. Line breaks are used in this example for readability.
curl -i -X POST -H "Cookie: $COMPUTE_COOKIE" -H "Content-Type: application/oracle-compute-v3+json" -H "Accept: application/oracle-compute-v3+json" -d "@requestbody.json" https://api-z999.compute.us0.oraclecloud.com/machineimage/
-
COMPUTE_COOKIE
is the name of the variable in which you stored the authentication cookie earlier. For information about retrieving the authentication cookie and storing it in a variable, see Authentication. -
api-z999.compute.us0.oraclecloud.com
is an example REST endpoint URL. Change this value to the REST endpoint URL of your Compute Classic site. For information about finding out REST endpoint URL for your site, see Send Requests.
Example of Request Body
The following shows an example of the request body content in the requestbody.json
file.
{ "account": "/Compute-acme/cloud_storage", "name": "/Compute-acme/jack.jones@example.com/oraclelinux-x64", "no_upload": true, "file": "oraclelinux-x64.img.tar.gz", "sizes": {"total":0} }
Example of Response Body
The following example shows the response body in JSON format.
Some lines may be truncated with ellipses (...) for readability.
{ "account": "/Compute-acme/cloud_storage", "name": "/Compute-acme/jack.jones@example.com/oraclelinux-x64", "sizes": { "uploaded": 1853334188, "total": 1853334188, "decompressed": 22020096000 }, "uri": "http://api-z999.compute.us0.oraclecloud.com/machineimage/Compute-acme/jack.jones@example.com/oraclelinux-x64", "quota": null, "platform": "linux", "no_upload": true, "state": "available", "signed_by": null, "file": "http://api-z999.compute.us0.oraclecloud.com:443/machineimage/Compute-acme/jack.jones@example.com/oraclelinux-x64", "signature": "", "checksums": {}, "attributes": {}, "error_reason": "", "image_format": "raw", "audited": null }