Skip to content

Instantly share code, notes, and snippets.

@rcj4747
Last active January 1, 2024 10:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rcj4747/74abedb3b4583b551d5411b4c9a5a877 to your computer and use it in GitHub Desktop.
Save rcj4747/74abedb3b4583b551d5411b4c9a5a877 to your computer and use it in GitHub Desktop.
An example of changing the datasource in cloud-init
# Get the Ubuntu cloud image of your choosing (this example uses the latest Xenial daily)
wget http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
# Set the cloud-init datasource to use explicitly (this example uses the EC2 datasource)
sudo mount-image-callback xenial-server-cloudimg-amd64-disk1.img -- \
sh -c 'echo "datasource: Ec2" > $MOUNTPOINT/etc/cloud/ds-identify.cfg'
# Confirm the current datasource configuration
sudo mount-image-callback xenial-server-cloudimg-amd64-disk1.img -- \
chroot _MOUNTPOINT_ cat /etc/cloud/ds-identify.cfg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment