From Fedora Project Wiki

DigitalOcean Installation Guide
How-To Guide


These steps could be useful to speed up a droplet deployment in order to test a Fedora image.

We will invoke DigitalOcean APIs using curl.


You need to setup an SSH key on DigitalOcean in order to access Fedora cloud images.
You need to generate a personal access token on DigitalOcean in order to be able to use the APIs.

Export some environment variables

export TOKEN="xxxxxxxxxxxxyourtokenxxxxxxxxxxx"
export IMAGE_NAME="Fedora_Test_image"
export IMAGE_URL=""
export REGION="nyc3"
export DROPLET_SIZE="s-1vcpu-1gb"
export DROPLET_NAME="FedoraTest"

Adapt these variables to your needs.

IMAGE_URL should point to the Fedora image URL to test (DigitalOcean supports qcow2 images but it doesn't support compressed raw ones).

To get a list of regions you can use the appropriate API ( Same thing for the droplet size.

Load an image to DigitalOcean

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${TOKEN}" -d '{"name": "'${IMAGE_NAME}'", "url": "'${IMAGE_URL}'", "distribution": "Fedora", "region": "'${REGION}'", "description": "Fedora Test", "tags":["base-image", "test"]}' ""

Wait some time, and verify that the image is in place

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer ${TOKEN}" ""

Take note of the image ID, and export a new variable.


List SSH keys and take note of the ID

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer ${TOKEN}" ""

Let's create a droplet

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${TOKEN}" -d '{"name":"'${DROPLET_NAME}'","region":"'${REGION}'","size":"'${DROPLET_SIZE}'","image":"'${IMAGE_ID}'","ssh_keys":['"${SSH_KEY_ID}"'],"backups":false,"ipv6":false,"user_data":null,"private_networking":null,"volumes": null,"tags":["test"]}' ""

List the droplet

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer ${TOKEN}" ""

Take note of the droplet ID and export another variable


Perform the tests

Now you can ssh as root to the virtual machine (you can get the IP using the list droplets API) and perform the test cases.

Don't forget to delete the droplet and the image

When you reach the end of your tests, and in order to avoid billing on unused resources, don't forget to delete the droplet and the image.

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${TOKEN}" -d '{"type":"destroy"}' "${DROPLET_ID}/actions"
curl -X DELETE -H "Content-Type: application/json" -H "Authorization: Bearer ${TOKEN}" "${IMAGE_ID}"