Question

Droplet static IP and cloud-init issues

  • Posted February 4, 2022

I’m migrating an app from bare metal to a VM and trying to decide whether a droplet is suitable. I have an Ubuntu image which includes web and mail servers, and a lot of custom code. This has a low resource requirement - the VM will have about 100 users with occasional web accesses, and some email list handling. The image is about 3GB, it needs one vCPU, and would probably run with 1GB RAM. Longer-term, I need about 150 of these VM instances.

Problem #1: droplets only seem to have DHCP-assigned addresses. How does this work? Does this mean they’re not suitable for public-facing websites and mail servers? Or do I have to use DigitalOcean DNS? I need to set up SPF and DKIM for the mail server

Problem #2: cloud-init seems to be required, for some reason. This is a custom image and nothing needs to be configured apart from a static IP address (and Ethernet device name/etc). The admin for this VM then sets up the simple stuff like the hostname, domain name, and so on, from a web interface. So, unless cloud-init can set a static IP address (which I don’t think it can) it seems to be useless, so it does nothing on this image. Is that acceptable?

Thanks.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Hello,

Each Droplet comes with a single fixed IPv4 address. Once the Droplet is created the IP address would be static and would not be changed but you can not define what IP gets assigned to your Droplet initially, this happens automatically.

Regarding the could-init, indeed this seems to be required according to the official documentation here:

https://docs.digitalocean.com/products/images/custom-images/

What I would personally do in such a case would be to deploy a base image like Ubuntu or Debian and install the required dependencies directly. Or alternatively, if you have an ansible playbook already, you could use it to do the initial server configuration.

Once the server is up and running with the required services installed, you could deploy your custom code via Git or SSH for example.

Best,

Bobby