Been using UNIX since the late 80s; Linux since the mid-90s; virtualization since the early 2000s and spent the past few years working in the cloud space.
Location
Alexandria, VA, USA
Education
B.S. Psychology from Pennsylvania State University
No need to curl, the userData content is stored under /var/lib/cloud/instances/. Depending how you structured your userData (e.g., if you only had a simple #!/bin/bash), the immediately-executable script content will be stored in /var/lib/cloud/instances/scripts/part-001. Meaning all you really need to do to re-run it is SSH into the host and do sudo bash var/lib/cloud/instances/scripts/part-001.
Things get a bit more complex if you've used multipart-MIME userData, but the underlying logic is similar.
Similarly, if you want to reboot your instance and have it rerun userData automatically, simply rm -rf var/lib/cloud/instances/<INSTANCE_ID>
No need to
curl
, the userData content is stored under/var/lib/cloud/instances/
. Depending how you structured your userData (e.g., if you only had a simple#!/bin/bash
), the immediately-executable script content will be stored in/var/lib/cloud/instances/scripts/part-001
. Meaning all you really need to do to re-run it is SSH into the host and dosudo bash var/lib/cloud/instances/scripts/part-001
.Things get a bit more complex if you've used multipart-MIME userData, but the underlying logic is similar.
Similarly, if you want to reboot your instance and have it rerun userData automatically, simply
rm -rf var/lib/cloud/instances/<INSTANCE_ID>
Good stuff, thanks!