1 00:00:06,491 --> 00:00:08,133 - Here we're going to talk about 2 00:00:08,133 --> 00:00:10,037 the instance metadata service 3 00:00:10,037 --> 00:00:11,537 within Amazon EC2. 4 00:00:13,142 --> 00:00:15,678 Now, the instance metadata service 5 00:00:15,678 --> 00:00:17,860 is a service by which we can 6 00:00:17,860 --> 00:00:21,774 retrieve information about an EC2 instance. 7 00:00:21,774 --> 00:00:25,033 You'll notice this very unique IP address here, 8 00:00:25,033 --> 00:00:29,200 169.254.169.254/latest/meta-data. 9 00:00:33,202 --> 00:00:37,375 From that URL, if we were to log into a EC2 instance 10 00:00:37,375 --> 00:00:39,305 and visit that URL, 11 00:00:39,305 --> 00:00:41,874 we could do it, in the case of Linux, we could use curl, 12 00:00:41,874 --> 00:00:44,946 in the case of Windows, we could use powershell commands 13 00:00:44,946 --> 00:00:48,366 to retrieve information from that URL. 14 00:00:48,366 --> 00:00:51,138 It's important to note that this particular service 15 00:00:51,138 --> 00:00:54,154 is not available outside of EC2. 16 00:00:54,154 --> 00:00:56,128 It's available within an instance 17 00:00:56,128 --> 00:00:59,976 for the instance to get information about itself. 18 00:00:59,976 --> 00:01:02,196 We cannot use this service to get information 19 00:01:02,196 --> 00:01:04,183 about another instance, 20 00:01:04,183 --> 00:01:07,549 but only for one instance to get information about itself. 21 00:01:07,549 --> 00:01:09,132 And from that service, 22 00:01:09,132 --> 00:01:13,225 we can retrieve such things as the AMI id 23 00:01:13,225 --> 00:01:15,123 that the instance is using. 24 00:01:15,123 --> 00:01:17,488 The hostname, the instance-id, 25 00:01:17,488 --> 00:01:19,482 the type of instance that it is, 26 00:01:19,482 --> 00:01:21,861 the private IP address, so on and so forth. 27 00:01:21,861 --> 00:01:25,402 There's all kinds of information we can use, 28 00:01:25,402 --> 00:01:27,804 or get from the instance metadata service, 29 00:01:27,804 --> 00:01:31,893 and typically we will use this service with scripts 30 00:01:31,893 --> 00:01:34,725 so that we can bootstrap this instance 31 00:01:34,725 --> 00:01:38,034 and get it up and running, configured automatically. 32 00:01:38,034 --> 00:01:42,100 So, the instance metadata service is often used 33 00:01:42,100 --> 00:01:44,715 with bootstrapping scripts 34 00:01:44,715 --> 00:01:46,703 so that when the instance boots, 35 00:01:46,703 --> 00:01:48,753 those initial scripts can 36 00:01:48,753 --> 00:01:50,845 call the instance metadata service, 37 00:01:50,845 --> 00:01:53,493 get information about the instance, 38 00:01:53,493 --> 00:01:56,212 you know, what it's hostname is, what it's ID, 39 00:01:56,212 --> 00:01:58,234 and use that information 40 00:01:58,234 --> 00:02:01,523 to automatically configure and bootstrap 41 00:02:01,523 --> 00:02:05,923 this instance to install software, to configure software, 42 00:02:05,923 --> 00:02:07,871 and to get that instance into a state 43 00:02:07,871 --> 00:02:11,685 where it can start doing it's job automatically. 44 00:02:11,685 --> 00:02:14,228 So, the instance metadata service, again, 45 00:02:14,228 --> 00:02:16,662 is available at this URL, 46 00:02:16,662 --> 00:02:19,562 only available from within an EC2 instance 47 00:02:19,562 --> 00:02:23,263 in order to help bootstrap and configure 48 00:02:23,263 --> 00:02:25,930 that server in an automated way.