DigitalOcean API and CLI (doctl)

DigitalOcean API and CLI (doctl) subscription active
You will receive email notifications for new publications on DigitalOcean API and CLI (doctl).
24 Results
  • Question

    Create Droplet via API then get public IP address and store as a variable

    Hi trying to create a bash script that creates a droplet, then once created gets the IP address of that droplet and store it as a variable to I used that IP address throughout the remaining bash script. Any pointers ...
    Accepted Answer: Hello, You could do something like this: First get create the new Droplet: ```bash !/bin/bash Here make sure to update your Token and the other Droplet details like the region, your SSH key and etc. newdroplet=$(curl ...
    1 By VicJones DigitalOcean API and CLI (doctl)
  • Question

    V2 create API POST call with Google Apps scripts

    I am trying to make a POST call work from within Google Apps scripts into the V2 create API. I have it working, but it doesn't execute the user_data formatted in either cloud-init or just as shell commands. Nothing sh...
    Accepted Answer: I discovered that you can use the Unicode encoding to put the LF in the json, and all it well now. For those wondering the code is : \u000A so "user_data" needed to look like this "user_data": "#!/bin/bash \u000A ...
    1 By FikesMedia DigitalOcean API and CLI (doctl) API JavaScript
  • Question

    Is it possible to tag a snapshot using the API?

    I see that in the snapshots API, there is a list of "tags" per snapshot. Is it possible to add a tag to a snapshot using the API? Also, is it possible to fetch all the snapshots with a certain tag?
    Accepted Answer: Hi @firedragondol, sorry for the confusion. You can tag Droplet Snapshots via the API - they're considered an image, so you would pass "resource_type":"image" Hope this helps!
    3 By firedragondol DigitalOcean API and CLI (doctl)
  • Question

    Progress Indicator for DOCTL Commands

    I'm building a script that automatically will shutdown a droplet before it creates a snapshot, and then powers it back on. The snapshot takes time to complete, but I think it would be great to see progress indicator. ...
    Accepted Answer: When scripting with doctl you can pass the --wait flag to Droplet "action" commands in order to block until the action has completed. For example: doctl compute droplet-action power-off --wait <^><droplet-id><^> Unf...
    1 By aaronmweiss DigitalOcean Linux Basics DigitalOcean API and CLI (doctl)
  • Question

    Ho to create database cluster with trusted sources with CLI or terraform ?

    I can not figure out how to create a managed database and set trusted sources with CLI (docli) or better Terraform. From the documentation: Endpoint: "" Body: { "name": "bac...
    Accepted Answer: Hello, This was very recently implemented to the DigitalOcean API, now the API supports managing a database cluster’s firewall rules (or “trusted sources” as they are called in the control panel). You can use this en...
    1 By marekgmyrek DigitalOcean API and CLI (doctl) DigitalOcean Managed PostgreSQL Database
  • Question

    Firewall droplet_id list

    VERSION DETAILS Terraform v0.12.13 + v2.29.0 + provider.digitalocean v1.7.0 + provider.null v2.1.2 + provider.template v2.1.2 PROBLEM I have the following terraform file which defined a DigitalOcean Clo...
    Accepted Answer: The best way to combine to lists of attributes using Terraform >= 0.12 syntax is to use the concat function. From the docs ( concat takes two or more ...
    1 By goodwillhacking Terraform DigitalOcean API and CLI (doctl)
  • Question

    How can I perform Add to Region and Restore Droplet actions on a backup or snapshot?

    The GUI offers "Add to Region" and "Restore Droplet" for a snapshot. How can I perform those actions on a backup or snapshot through the API?
    Accepted Answer: After you take a snapshot of a Droplet, you can find the ID of that snapshot via the API by querying the /v2/images?private=true endpoint ( ...
    1 By csabatothus DigitalOcean API and CLI (doctl)
  • Question

    Not receiving metric data. Last working Just now

    Centos 7 droplet with freshly upgraded do-agent. How do I troubleshoot do-agent to resolve this?
    Accepted Answer: OK, apparently it had to do with not allowing enough sites to run JavaScript. Because of course I'm going to have to allow 15 different sites to run JavaScript to have one site work correctly.
    4 By jtrigg DigitalOcean API and CLI (doctl)
  • Question

    Is it possible to get the ssh key (name or id) of a droplet through api?

    Would like to know if we can get the name or id of the ssh key of a droplet through API because while creating droplet from the snapshot I don't want pass all the keys in my account. Is there any other way to solve it.
    2 By vimalSeal DigitalOcean API and CLI (doctl)
  • Question

    when i run this command Command snapshot 179695800 --snapshot-name snapshot_name it showing command not found

    Command 'snapshot' not found, did you mean: command 'rsnapshot' from deb rsnapshot Try: sudo apt install <deb name>
    1 By manjunathab DigitalOcean API and CLI (doctl)
  • Question

    How to create droplet in aws lambda

    I am trying to implement a lambda function that creates a droplet. However, after the creation line of code, lambda stucks, and timeouts. In addition, in most of cases, it cannot create a droplet. The result is the sa...
    1 By ibekmezcicloud DigitalOcean API and CLI (doctl)
  • Question

    How to optimize all images present on digitalocean spaces

    I created a site and loaded the images on to digitalocean spaces. However those images are not optimized. Is there a way to optimize all of them on digital ocean spaces itself using some api or script? instead of purg...
    1 By nabtron DigitalOcean Spaces DigitalOcean API and CLI (doctl)
  • Question

    Error on installation the monitoring matric agent

    Got the following error after run the installation script for monitoring matric agent ``` curl -sSL | sudo bash Cleaning up old sources...OK Verifying machine compati...
    1 By attawit DigitalOcean API and CLI (doctl)
  • Question

    Access granted with password login to SSH enabled droplet

    I have security concern here. I have enabled SSH to my droplet and if i wanted to access the droplet via GitBash via windows10 i need to have my SSH public key saved to my DigitalOcean account. when i do ssh root@123....
    1 By nax DigitalOcean API and CLI (doctl)
  • Question

    Github action deploy dotnet app to a single droplet

    How would I go about creating a github action to deploy a dotnet app to an existing droplet - without docker? If that's not possible, can I SSH into the droplet using a pwd and running a command inside of it? Basical...
    1 By Slothmachine API Git Linux Commands DigitalOcean API and CLI (doctl)
  • Question

    SFTP with Filezilla credentials to remote app re-setup + more

    nanobox tunnel command is not working since nanobox was reinstalled but all source code still remains in my local repo. Network admin here for all employees gave us all new windows 10 profiles but all data migrated ov...
    1 By Abcwebtech DigitalOcean API and CLI (doctl)
  • Question

    How can I split API Key for Read Write

    I have 3 projects under my company account. Each project has one droplet at the moment. Now I want to provide API key for his Mobile to manage one project only with READ + WRITE. Then Other 2 Projects READ Only. How c...
    1 By aungtun DigitalOcean API and CLI (doctl)
  • Question

    can not log in from terminal

    hi , i have generate a rsa keypair and added the pubkey into my account security settings, but i still cannot log in my server , if remember correctly , i must log in from terminal first, then add the pubkey into ~/.s...
    1 By sanhai0224 DigitalOcean API and CLI (doctl)
  • Question

    How to restrict token use withint applications of specific IP address?

    I am using digital ocean's python api. I generated a token and successfully created a couple of droplets using snapshots. In order to make the use of the token safer, is there a way to restrict the use of the token fr...
    1 By d4ng3r09 DigitalOcean API and CLI (doctl)
  • Question

    When saving Kubernetes config from doctl with an existing API token, another token is created . Is this normal?

    Let's say I want to programmatically save the Kubeconfig of my Kubernetes cluster using doctl : doctl -t "$DIGITALOCEAN_ACCESS_TOKEN" \ kubernetes cluster kubeconfig save "$CLUSTER_NAME" I have at my disposal ...
    1 By fredmetronome DigitalOcean API and CLI (doctl) DigitalOcean Managed Kubernetes