generic cloud init help and docs
treats user data and cloud init as cloud-init
- logs to
/var/log/cloud-init.log
/var/log/cloud-init-output.log
** There is a known bug with support of cloud-init on ertain distrubutions of linux**
- https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cloud-init-troubleshooting
- https://learn.microsoft.com/en-us/azure/virtual-machines/custom-data
- https://cloudinit.readthedocs.io/en/latest/topics/datasources/azure.html
**GCP DOES NOT support CLOUD-INIT (even under RHEL) without help generally if your setting CLOUD init you need a custom image **
- debug tipps https://gist.github.com/RagedUnicorn/a70f8540c68e0a41e3e097a2e29130f1
- debug script https://gist.github.com/smoser/dd45b6324be937b67b80bac7aa1a6c47
- helpers https://gist.github.com/smoser/6391b854e6a80475aac473bba4ef0310
# If you add the -v --verbose flag
# Or the -i --include flag
curl -v http://169.254.169.254/latest/
curl -i http://169.254.169.254/latest/
# You'll see HTTP/1.1 401 Unauthorized
export TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
echo $TOKEN
curl -H "X-aws-ec2-metadata-token: $TOKEN" -i http://169.254.169.254/latest/
# ^-- now says HTTP/1.1 200 OK
# A nice shorthand hack to make v2 feel like v1
# (that's probably best done in the active shell only)
# and not in a .bashrc or .zshrc file
alias curl='curl -H "X-aws-ec2-metadata-token: $TOKEN"'
curl -i http://169.254.169.254/latest/
# ^-- now says HTTP/1.1 200 OK
- https://aws.amazon.com/premiumsupport/knowledge-center/ec2-linux-log-user-data/
- logs to
/var/log/cloud-init.log
/var/log/cloud-init-output.log
- debug reruns https://aws.amazon.com/premiumsupport/knowledge-center/execute-user-data-ec2/
- access the metadata
curl http://instance-data/latest/user-data > user-data.sh
- https://dev.to/denolfe/easily-rerun-ec2-userdata-3k18
- https://aws.amazon.com/premiumsupport/knowledge-center/ec2-windows-troubleshoot-user-data/
- https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html
- metadata for helpful reasons https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/instancedata-data-categories.html
GCP uses a go app called google_metadata_scrpt_runner
**GCP DOES NOT support CLOUD-INIT (even under RHEL) without help generally if your setting CLOUD init you need a custom image
**
- https://cloud.google.com/compute/docs/instances/startup-scripts/linux
- https://pkg.go.dev/github.com/GoogleCloudPlatform/guest-agent/google_metadata_script_runner#section-sourcefiles
The script can be run locally from the instance
sudo google_metadata_script_runner startup
- and you can view logs with
sudo journalctl -u google-startup-scripts.service
- https://cloud.google.com/compute/docs/instances/startup-scripts/linux#rerunning
- under LFS teh scripts can be found at
/usr/share/cloud
/var/lib/cloud/instances