Managing Instance Lifecycle Operations
When your instance is running, you can use the web console to restart it, delete it, or delete and re-create it.
Rebooting an Instance
After your instance is running, if required, you can reboot your instance from the web console.
WARNING:
When you shut down or reboot an instance, you might lose data on any nonpersistent boot disks, including NVMe SSD disks, that are attached automatically as part of the high I/O shapes.When you reboot an instance, data on storage volumes (whether persistent or nonpersistent) isn’t lost. Your instance also retains all its configuration information, such as its public IP address and storage volumes that were attached and mounted on the instance.
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 Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.
To reboot an instance using the CLI, use the opc compute reboot-instance-request add
command. For help with that command, run the command with the -h
option. For the instructions to install the CLI client, see Preparing to Use the Compute Classic CLI in CLI Reference for Oracle Cloud Infrastructure Compute Classic.
To reboot an instance using the API, use the POST /rebootinstancerequest/
method. For more information, see REST API for Oracle Cloud Infrastructure Compute Classic.
Shutting Down and Restarting an Instance
If you created an instance using a persistent bootable storage volume, then, if you don’t need the instance, you can shut down the instance. However, the instance isn’t deleted. After shutting down an instance, you can restart the instance later, without losing any of the instance data or configuration.
If you no longer need an instance, you can delete the instance by terminating or suspending the relevant orchestration. You can always re-create an instance by starting the appropriate orchestration later.
Shutting down an instance is useful when you’ve created multiple instances in a single orchestration. In this case, stopping or suspending the orchestration would cause all instances to be deleted. If you want to shut down one or more instances, while letting other instances in the same orchestration run, you can shut down the required instances individually.
WARNING:
Shut down or restart the instance using the Compute Classic web console, REST API, or CLI. Do not log in to the instance, and then use the halt, shutdown or shutdown —h commands to shut down the instance. Doing so will stop the instance indefinitely and will require manual intervention by Oracle Cloud system administrators to restart the compute node.
Here’s what happens when you shut down an instance:
WARNING:
When you shut down or reboot an instance, you might lose data on any nonpersistent boot disks, including NVMe SSD disks, that are attached automatically as part of the high I/O shapes.-
The instance ID is retained and reused when you restart the instance. So the multipart instance name doesn’t change. This is useful in case the instance name is referenced by other objects, such as storage attachments.
-
For instances created using orchestrations v1, the instance orchestration shows an error. However, even if the HA policy specified is
active
, the instance isn’t automatically re-created. -
For instances created using orchestrations v2, the orchestration doesn’t show an error. The orchestration JSON shows the status of the instance as
shutdown
. -
The resources associated with that instance, such as OCPUs, and IP reservations, are freed up and can be used by other instances if required. However, if you attempt to restart an instance, ensure that the required resources are available, otherwise the instance can’t restart and will go into an error state.
-
The private IP address on the shared network is released. If you restart the instance later, it is allotted a private IP address afresh. So the private IP address of the instance on the shared network is likely to change.
-
Dynamically allocated IP addresses on IP networks are also released. So if you start the instance later, dynamically allocated IP addresses on IP networks are also likely to change. Static private IP addresses that are allocated to the instance interfaces in the orchestration won’t change.
-
Any changes that you’d made to the instance in Compute Classic after the instance was created might be lost. For example, if you added the instance to security lists, attached storage volumes to the instance, or detached and attached an IP reservation, you might need to make those changes again.
Note:
Changes made to the instance by logging in to the instance won’t be lost, however, as these are preserved on the persistent storage volumes attached to the instance. Data on storage volumes isn’t affected by stopping an instance.
Prerequisites
-
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 Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud. -
Ensure that the instance that you want to shut down uses a persistent boot disk.
Procedure
To shut down an instance using the CLI, use the opc compute instance update [--desired-state shutdown]
command. To restart an instance, use the opc compute instance update [--desired-state running]
command. For help with these commands, run each command with the -h
option. For the instructions to install the CLI client, see Preparing to Use the Compute Classic CLI in CLI Reference for Oracle Cloud Infrastructure Compute Classic.
To shut down an instance using the API, use the PUT /instance/name
method and specify the desired_state
as shutdown
. To restart an instance, use the PUT /instance/name
method and specify the desired_state
as running
. See REST API for Oracle Cloud Infrastructure Compute Classic.
Deleting an Instance
Instances created using the web console are managed by orchestrations. To delete such an instance, you must terminate the corresponding orchestration. If your instance was created by using the Create Instance wizard before mid-May 2016, or if it was created by defining a launch plan using the API, then it is not managed by an orchestration. In this case, you can delete the instance directly from the Instances page of the web console.
If you want to delete an instance created using orchestrations v2, and you want to retain the data on the attached storage volumes, then ensure that your instance has persistence specified as false and that the relevant storage volumes and other objects in the orchestration have persistence specified as true. This allows you to suspend the orchestration, which deletes only nonpersistent objects while persistent objects are preserved.
If you want to delete an instance created using orchestrations v1, and you want to retain the data on the attached storage volumes, ensure that you terminate only the instance orchestration, not the master orchestration. If you terminate the master orchestration, both the instance and other resources such as storage volumes that were created while creating the instance will be deleted. If you start the master orchestration again later on to re-create the instance, the storage volumes will be re-created; however, the data that you had written to those storage volumes will be lost.
Caution:
If you delete an instance that uses a nonpersistent boot disk, any changes you may have made to the boot disk after the instance was created are lost. If you want to preserve changes to the nonpersistent boot disk, you can create an instance snapshot. See Cloning an Instance by Using Instance Snapshots.
Here’s what happens when you delete an instance:
WARNING:
When you shut down or reboot an instance, you might lose data on any nonpersistent boot disks, including NVMe SSD disks, that are attached automatically as part of the high I/O shapes.-
The resources associated with that instance, such as storage volumes and IP reservations, are freed up and can be used by other instances if required. However, if you attempt to re-create an instance, ensure that the required resources are available, otherwise the instance can’t be created. The instance orchestration will go into an error state.
-
The private IP address on the shared network is released and might be allotted to another instance. If you re-create the instance later, it is allotted a private IP address afresh. So the private IP address of the instance on the shared network is likely to change.
-
Dynamically allocated IP addresses on IP networks are also released. So if you re-create the instance, dynamically allocated private IP addresses on IP networks are also likely to change. Static private IP addresses that are allocated to instance interfaces in the orchestration won’t change.
-
Any changes that you’d made to the instance in Compute Classic after the instance was created will be lost. For example, if you added the instance to security lists, attached storage volumes to the instance, or detached and attached an IP reservation, you’ll need to make those changes again. The instance will be re-created with the resources that are associated with it in the orchestration.
Note:
If the instance uses a persistent boot disk, changes made to the instance by logging in to the instance won’t be lost when you delete an instance.
Prerequisites
-
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 Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud. -
Any storage volumes that were attached to an instance after the instance was created, are detached (but not deleted) when you delete the instance. You must unmount these storage volumes before deleting an instance. See Mounting and Unmounting a Storage Volume.
Procedure
If you created an instance using a launch plan, then to delete that instance using the CLI, use the opc compute instance delete
command. Otherwise, to delete an instance by terminating an orchestration v1, use the opc compute orchestration update ––action STOP
command. To delete an instance by terminating an orchestration v2, use the opc compute orchestration—v2 update [--desired-state inactive]
command. For help with these commands, run each command with the -h
option. For the instructions to install the CLI client, see Preparing to Use the Compute Classic CLI in CLI Reference for Oracle Cloud Infrastructure Compute Classic.
If you created an instance using a launch plan, then to delete that instance using the API, use the DELETE /instance/name
method. To delete a nonpersistent instance by suspending an orchestration v2, use the PUT /platform/v1/orchestration
method with the query argument desired_state=suspend
. Otherwise, to delete an instance by terminating an orchestration v1, use the PUT /orchestration/name
method with the query argument action=STOP
. See REST API for Oracle Cloud Infrastructure Compute Classic.
Deleting and Re-creating an Instance
After creating an instance, if you no longer need the instance, you can delete it. If you want to use the same instance again later on, you can re-create the instance.
WARNING:
When you shut down or reboot an instance, you might lose data on any nonpersistent boot disks, including NVMe SSD disks, that are attached automatically as part of the high I/O shapes.All instances that are created by using the Create Instance wizard, or by adding an orchestration, can be deleted and re-created by terminating and starting the orchestration that controls the instance.
When you create an instance using the Create Instance wizard, a single orchestration v2 is created automatically to manage the instance and its associated resources. Storage volumes and networking objects used by the instance are created in the same orchestration. Instances are nonpersistent by default. However, storage volumes and other objects are created with persistence set to true, so that if you suspend the orchestration, instances are shut down, but storage volumes aren’t deleted. Terminating the orchestration, however, will cause all objects to be deleted and any data on storage volumes will be lost.
Earlier, when you created an instance using the Create Instance wizard, one or more orchestrations v1 were created automatically to manage the instance and its associated resources. For example, if you used the Create Instance wizard to create an instance and attach a new storage volume to it, then two separate orchestrations were created, one for the instance and the other for the storage volume. A master orchestration was also created, and the instance and storage volume orchestrations were referenced as objects in the master orchestration.
Prerequisites
-
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 Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud. -
Any storage volumes that were attached to an instance after the instance was created, are detached (but not deleted) when you delete the instance. You must unmount these storage volumes before deleting an instance. See Unmounting a Storage Volume from a Linux Instance, Unmounting a Storage Volume from an Oracle Solaris Instance, or Unmounting a Storage Volume from a Windows Instance.
Procedure
To use the CLI to delete and re-create an instance that is managed by an orchestration, use the opc compute orchestration—v2 update ––action STOP
command followed by the opc compute orchestration—v2 update ––action START
command. For help with these commands, run each command with the -h
option. For the instructions to install the CLI client, see Preparing to Use the Compute Classic CLI in CLI Reference for Oracle Cloud Infrastructure Compute Classic.
To use the API to delete and re-create an instance that is managed by an orchestration, use the PUT /orchestration/name
method with the query argument action=STOP
followed by the PUT /orchestration/name
method with the query argument action=START
. For more information, see REST API for Oracle Cloud Infrastructure Compute Classic.