Ssh hosts keys after copying container

I’m guessing the answer will be very short, but would it be expected that a container’s ssh host keys would change after being copied to another LXD host using:

lxc copy [container]/[snapshot] [newhost]:[container]

Thanks.

And very closely related to this question, would host keys of a container change after migrating LXD from apt version to snap version using:

lxd.migrate

Again, thanks.

In both cases, it depends on whether the container has cloud-init installed.
If it does, then yes, a clone/copy will cause the instance id to chance which will cause cloud-init to generate a new SSH host key.

if cloud-init isn’t installed, then no, the host key will remain the same.

Thank you for this!

I know this might be hard to answer, but if I’m not using any of the things cloud-init does, is it safe to simply disable it?

Yes, as the LXD build images (those starting images: but don’t end in /cloud) don’t have it installed.