TheKoguryo's Tech Blog

 Version 2024.04.01

Warning

This content has been generated by machine translation. The translations are automated and have not undergone human review or validation.

9.2 Create Custom Image from Instance

Important

The instance goes offline for a few minutes while the image is being created. It is recommended to stop the instance while creating a custom image, and if you proceed while it is running, it is forcibly stopped. Interruptions can cause problems with your data

Even if the target instance to create a Custom Image is equipped with a Block Volume, only the Boot Volume is included when creating a Custom Image.

Create Custom Image

  1. Connect to the test VM and make a trace before creating a Custom Image.

    [opc@examplelinuxinstance ~]$ echo 'See you soon' > hello.txt
    [opc@examplelinuxinstance ~]$ cat hello.txt
    See you soon
    
  2. Before creating a Custom Image, be sure to exit at the OS level first.

    [opc@examplelinuxinstance ~]$ sudo su
    [root@examplelinuxinstance opc]# shutdown now
    Connection to 140.238.29.108 closed by remote host.
    Connection to 140.238.29.108 closed.
    
  3. Open the navigation menu in the OCI console. Go to Compute > Instances.

  4. In the Compute Instance list, click the target instance.

  5. After confirming once again whether the shutdown is at the OS level, exit with the Stop command in the console.

  6. When the instance is stopped, click Create custom image.

    image-20220114174836514

  7. Select a compartment to save the custom image, enter a name and click Create custom image.

    • Name: Ex) ExampleLinuxCustomImage
    • In the warning below, it is recommended to terminate the instance after shutting down the OS before creating the Custom Image.

    image-20220114175004752

  8. Image is being created.

    image-20220114175132477

  9. Go back to the instance list screen and go to the Custom Images menu on the left to see the current Custom Image list.

    image-20220114175525336

Create a new instance of Custom Image

Method 1

  1. Select a desired image from the Custom Images list and click Create Instance in the right action menu to move to the instance creation screen based on the image.

    image-20220114175704124

  2. Enter any other required information and create an instance.

Method 2

  1. Open the navigation menu in the OCI console. Go to Compute > Instances.
  2. Click Create Instance to start creating an instance.
  3. Change the image via Change Image in Image and Shape.
  4. Under Image Sources, select Custom Images.
  5. Select Compartment with Custom Images and you will see a list of available Custom Images. Select the Custom Image you want to use and click Select Image. image-20220114180030531
  6. Enter any other required information and create an instance.

verification

  1. An instance was created based on the Custom Image.

    image-20220114234354695

  2. Connect to the created instance and check if there is a previously created file.

    ubuntu@NOTEBOOK-WORK:~/.ssh$ ssh -i mysshkey opc@129.154.219.239
    Last login: Fri Jan 14 14:31:26 2022 from 220.117.236.6
    [opc@examplelinuxinstance-fromcustomimage ~]$ ls
    hello.txt
    [opc@examplelinuxinstance-fromcustomimage ~]$ cat hello.txt
    See you soon
    


As an individual, this article was written with my personal time. There may be errors in the content of the article, and the opinions in the article are personal opinions.

Last updated on 14 Jan 2022