- Okay, so now let's talk about
the Instance Metadata Service.
The Instance Metadata Service is a very special
URL available to us that we can query
in order to get information about an EC2 instance,
and that URL looks something like this,
HTTP 169.254.169.254/latest/meta-data,
and, of course, if we were to query that URL,
we would get back a list of other URLs that we can reach,
and what this does is that from within an EC2 instance,
we can use this URL to retrieve
information about that instance.
An EC2 instance can use this
to get information about itself.
We cannot access this URL from outside an instance,
and we cannot use this URL in order for one instance
to get information about another.
It's always so that one EC2 instance
can get information about itself,
and so this is very useful
when it comes to bootstrapping EC2 instances
or doing some type of programmatic response
to the environment
so that when a machine comes to life, it can go and find out
what type of machine is it supposed to be?
What type of job is it supposed to perform?
What is my IP address?
What type of volumes do I have attached?
Those kinds of things are available,
and so there's all kinds of information
that we can retrieve through the Instance Metadata Service.
We can retrieve the machine image ID.
We can retrieve the DNS host name, the instance ID,
the instance type, the private IP address,
and of course, again, this is often used
with different types of scripts
for instance-specific configuration.
So one of the really powerful and beautiful things about AWS
is the level of automation,
and as we will talk more about later,
the only way to truly realize the power of AWS,
the cost savings, the flexibility, the agility,
is through leveraging automation,
and this is one of the critical or key components
to enabling automation,
is when we have instances come to life through autoscaling
which we'll talk about later,
ideally, that instance is able to configure itself,
ensure that whatever software is needed
is installed, configured,
and whatever processes are needed are running
so that machine can come to life and get to work
doing what it's supposed to do,
and so the Instance Metadata Service
provides a very rich API
so that machine has all of the information
that it could possibly need at its disposal
in order to programmatically,
essentially become what it's supposed to become
and get to work doing what it's supposed to do,
and so we will take a closer look
at the Instance Metadata Service in upcoming lessons.