Skip to content

Instantly share code, notes, and snippets.

@filipeandre
Created May 29, 2024 10:45
Show Gist options
  • Save filipeandre/0165f118c883bb3a08b056b241e0d28c to your computer and use it in GitHub Desktop.
Save filipeandre/0165f118c883bb3a08b056b241e0d28c to your computer and use it in GitHub Desktop.
Get user data script from EC2
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
export INSTANCE_ID=`curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/instance-id`
sudo cat /var/lib/cloud/instances/$INSTANCE_ID/user-data.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment