Create a Droplet from a snapshot using the snapshot's name instead of its id

July 28, 2019 309 views
API

I am trying to create a droplet using a previously created snapshot but I need to use the snapshot’s name instead of its id.
Is that possible? If not, how can I automatically grab the snapshot id after listing all my snapshots, based on its name?

2 Answers

Hello!

You can create a droplet from a snapshot and you should be able to use the snapshot’s name as well.

Once you’ve created the snapshot you can simply follow these steps:

  1. Click Create > Droplets.
  2. Click on Snapshots.
  3. Select the snapshot.
  4. Select the size, Droplet region and additional parameters.
  5. Click on Create.

Let me know if you have any questions.

Alex

  • Oh.... I forgot to mention that I was trying to do it using the doctl.

    • Thanks for explaining this. This is an example doctl command to create droplet from a snapshot:

      doctl compute droplet create newdroplet --size 2gb --image debian-8-x64 --region nyc1
      

      To create a new Droplet from an image, first you need to get the unique image ID using the below command.

      doctl compute image list-user
      

      Then you can create the new Droplet from the image with the image ID.

      doctl compute droplet create testserver --size 1gb --image imageID --region nyc1
      

      And of course you need to replace the imageID with the image ID you want to use.

      Alex

      • Is there a way to use the droplet’s name or tag instead the image ID?

        • I’m sorry for the delay. Did you tried using the following command:

          doctl compute droplet create newdroplet –size 2gb –image debian-8-x64 –region nyc1

          where newdroplet is the name of your droplet (you can choose anything you want).

          Let me know how it goes.

          Alex

          • It doesn’t work. I am aware that I’m required to specify the image ID, but I am wondering if it’s possible to use the image’s name instead of the ID.

Have another answer? Share your knowledge.