- [Blaine] Let's look at a specific question from the SysOps Administrator Certification Exam. Together, we'll break it down, identify the critical parts of the stem, go through the responses, and find the key. We will also explore why that response was correct, along with why the other distractors were not. Reminder that the questions we use in this course are at the same difficulty level and structure as those on the real exam, but these are not from the real exam. It's against the terms and conditions of the AWS Certifications to share actual exam questions. It's how the Certification keeps its value. And we really appreciate how you are helping to preserve that value for you and other SysOps administrators around the world. This question is from Subdomain 3.1: Provision and maintain cloud resources. Here's the stem. A systems administrator is writing a configuration script that requires the public IP of an Amazon EC2 instance on which it is run. How can the administrator obtain the IP address? I'll show you the answers in a minute, but, first, let's break down the stem. What are the key pieces here? The script requires a public IP of an EC2 instance. This should be an immediate signal to remember your networking information. Every instance can have multiple IP addresses. They always have a private IP, and they sometimes have a public IP. Nowhere else in the stem does it mention that the public IP may or may not be there, so we don't have to worry about making sure that the instance actually has the public IP. Whatever other systems are in play here, that part is taken care of. Let's see. The script requires the public IP of an instance on which it is run. Okay, this matters. This is not a separate machine. It's not a Lambda instance. So, we might have some unique tools we can use to solve the problem, or there might be some unique barriers we need to overcome. Last part of the stem: What is actually being asked? In my opinion, by the way, this is the most important part of the stem. And for longer questions, I'll actually read this part first, before then reading the entire stem altogether. Here, how can the administrator obtain the IP address? We talked about horses, not zebras. If you hear hoofbeats in Canada, you can safely assume you are hearing horses, not zebras. The obvious answer is almost always the correct answer. Do not assume any zebras on this part of the stem. If you are asking: Are they talking about the public or the private IP? You're trying to find a zebra. The only IP discussed before this clause were public IPs, so even though this sentence does not specify, go with the previously established pronoun and note the exam is asking for the public, and not the private IP. Cool. At this point, if you are an experienced SysOps admin, you likely already have a solution you would use. Let's take a look at the responses, and see if any of them match your idea. A. From the operating system of the EC2 instance. B. From the instance metadata service associated with that EC2 instance. C. From an Elastic IP that is attached to every EC2 instance. D. From the metadata associated with the AMI that was used to launch the EC2 instance. Take a moment, pause the video if you need, and select which response is the key, the correct response. Ready? The key here is B. From the instance metadata service associated with that EC2 instance. As part of the script you are writing, you can write a cURL statement to the metadata service from that instance. The metadata service, 169.254.169.254, this is an unroutable IP address, which means that if you look at the stem, the critical part, on which it was run, works. If we were running the script from a Lambda function, it would fail. Right, what about the other responses, the distractors? Remember, distractors must be plausible, but wrong. So even if you had forgotten about the metadata service, you should still be able to eliminate the wrong choices. Response A. From the operating system of the instance. Right, what's wrong here? If you query the IP from the OS of a running EC2 instance, you'll always get an IP address. You'll get the private IP address, not the associated public IP address. If you want the public IP, that method doesn't work. Response C. From an Elastic IP that is attached to every EC2 instance. Now, I actually like this one, at first. It may not be a best practice to use Elastic IPs in general, but if you want to always know the public IP address of an instance, for example, if you want to pre-approve a public IP address with a vendor's access list, EIPs are your best choice here. The flaw here is attaching this Elastic IP to every EC2 instance. Not possible. An Elastic IP can only be attached to one instance at a time, and if you have multiples, this will fail. Response D. The metadata associated with an AMI used to launch the instance. Now, here is where you may get stuck if you are not familiar enough with the metadata service because they're absolutely metadata associated with an AMI, but none of them would include the IP addresses of the instances that would be built from those AMIs. So A, C, and D are all distractors, plausible and yet wrong, while B is the key for this question.