By alimakki
When using the DigitalOcean API to create a new droplet, is there a way to have the droplet run a command or script once it spins (using the API)?
Thanks.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
you specify it in the user-data tab, your droplet will run cloud-init on boot, and you can specify your script should only run once. You can do loads of stuff in your cloud-init config
Hi @alastairc, thanks for replying.
Just a few more questions
you specify it in the user-data tab,
Where do I find the user-data tab?
Can those be built by using the DO API as well (i.e. built programmatically)?
Thanks!
You can also send user-data via the API populating the user-data field in your request to the create endpoint.
Exactly what I was looking for!
Thank you @ryanpq
And also thanks @alastairc for your suggestions as well.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.