- Here we're going to talk about
the instance metadata service
within Amazon EC2.
Now, the instance metadata service
is a service by which we can
retrieve information about an EC2 instance.
You'll notice this very unique IP address here,
169.254.169.254/latest/meta-data.
From that URL, if we were to log into a EC2 instance
and visit that URL,
we could do it, in the case of Linux, we could use curl,
in the case of Windows, we could use powershell commands
to retrieve information from that URL.
It's important to note that this particular service
is not available outside of EC2.
It's available within an instance
for the instance to get information about itself.
We cannot use this service to get information
about another instance,
but only for one instance to get information about itself.
And from that service,
we can retrieve such things as the AMI id
that the instance is using.
The hostname, the instance-id,
the type of instance that it is,
the private IP address, so on and so forth.
There's all kinds of information we can use,
or get from the instance metadata service,
and typically we will use this service with scripts
so that we can bootstrap this instance
and get it up and running, configured automatically.
So, the instance metadata service is often used
with bootstrapping scripts
so that when the instance boots,
those initial scripts can
call the instance metadata service,
get information about the instance,
you know, what it's hostname is, what it's ID,
and use that information
to automatically configure and bootstrap
this instance to install software, to configure software,
and to get that instance into a state
where it can start doing it's job automatically.
So, the instance metadata service, again,
is available at this URL,
only available from within an EC2 instance
in order to help bootstrap and configure
that server in an automated way.