nocloud-ds is a HTTP server for NoCloud datasource of cloud-init. It can serve different instance data based on client's IP address.
See the releases page.
Download and extract the archive, and then put the binary into the directory listed in $PATH
.
Make sure Go distribution is installed, and then run go install
.
$ go install github.com/ryot4/nocloud-ds@latest
At first, prepare the datasource directory and instance data to serve. You can serve different data for different clients by creating directories named after their IP addresses as in the following example.
datasource/
├── 192.168.1.23/ # Data for 192.168.1.23 (no vendor-data)
│ ├── meta-data
│ └── user-data
├── meta-data # Data for other clients
├── user-data
└── vendor-data
Then, run nocloud-ds
. You can specify the listen address and the path to the datasource directory.
$ nocloud-ds -l address:port -d /path/to/datasource
You can also pass parameters with environment variables.
$ NOCLOUD_DS_LISTEN_ADDRESS=address:port NOCLOUD_DS_DIR=/path/to/datasource nocloud-ds
If X-Forwarded-For
header is set in the request, the server uses the client address in the header to find instance data.