Now, we go back to the Cloud Shell for creating the new custom image.
ibmcloud is instance-stop ${CUSTOM_IMG_VSI_NAME}
# Store Volume ID in a environment variable
SOURCE_VOLUME_ID=$(ibmcloud is instance ${CUSTOM_IMG_VSI_NAME} --output JSON | jq -r .volume_attachments[0].volume.id)
# Submit request to create image from the volume
ibmcloud is image-create ${CUSTOM_IMG_NAME} --source-volume ${SOURCE_VOLUME_ID}
This step can take some time depending on the image size. You can check the webpage of the images (Navigation Menu –> VPC Infrastructure –> Custom images) for the status of the image creation.
ibmcloud is instance-delete ${CUSTOM_IMG_VSI_NAME}