Question

Auto assign floating IP

Posted August 5, 2016 3.7k views
DigitalOcean API DNS Backups Configuration Management Deployment

I sometimes run a game server for my friends and I to use, but it’s not on most of the time so I usually snapshot it and destroy it, and restore the snapshot a few days later when we play again. I was wondering if there’s a way to automatically assign my floating IP to the one server I have when it’s created.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

Hi,

As of right now, there isn’t a simple way to do it through the control panel, other than manually attaching the IP after the Droplet is created. However, you can use the API to do that. Here’s a rough outline of how it would work:

  1. create a new Droplet and store its ID
  2. check its status every few seconds and wait until it’s Active
  3. finally, attach your Floating IP to the Droplet.
Submit an Answer