Skip to content

Instantly share code, notes, and snippets.

@sapslaj
Created May 30, 2024 13:24
Show Gist options
  • Save sapslaj/1eee8117956c68a7d96bcece5ef95391 to your computer and use it in GitHub Desktop.
Save sapslaj/1eee8117956c68a7d96bcece5ef95391 to your computer and use it in GitHub Desktop.
AWS EC2 IMDS helper script
#!/bin/sh
set -e
TOKEN=`curl -sSL -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/$1
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment