AMI configuration best practice


I am using packer for some personal projects running on Hetzner Cloud. Right now, most of my configuration values such as domain names are more or less hard-coded into the AMIs. However, that means a rebuild each time something changes and this also makes test deployments hard without building a custom AMI with fixed values.

What is the typical approach here to get configuration values into the deployed machines?

For docker environment variables are pretty established. This is not that easy with real VMs where no well-defined entrypoint exists. I was thinking about letting the AMI user provide such configuration values using cloud-init. Is that an acceptable approach? Or how do others solve this problem? As I am using Hetzner, things like AWS SSM are not available.


We use cloud-init as you suggested to pass in environment specific values