AWS User-data Address
Luke Hebert
- One minute read - 158 wordsIf you need to retrieve the user data script you passed at launch time, the EC2 instance metadata service gives you a direct endpoint to pull it. No external tools or API calls required, just a simple HTTP request from inside the instance.
The Metadata Endpoint
AWS EC2 user data is accessible from within the instance itself via the instance metadata service. The specific address to retrieve user data is:
http://169.254.169.254/latest/user-dataThis is a special link-local IP address used within AWS for accessing instance metadata, including user data. You can use tools like curl from within your EC2 instance to retrieve the user data provided during launch:
curl http://169.254.169.254/latest/user-dataWhere User Data Is Stored
On Linux instances, the user data script is typically stored in a file under /var/lib/cloud/instance/user-data.txt after being processed by cloud-init. On Windows instances, the location may vary, but it is often found in temporary directories related to the EC2Launch or EC2Config services.