亚马逊EC2的用户数据,它是如何工作的? [英] Amazon ec2 user-data, how does it work?
问题描述
我们开始实例,并访问用户数据,我们的地方。但是,有谁知道这个操作的内部(从亚马逊的一侧)?当我们在传递用户数据,在什么点是传送到虚拟机的数据(这是一个Xen的功能),并在那里被它存储在哪里?
We are starting instances, and accessing the user-data we place. But does anybody understand the internals of this operation (from Amazon's side)? When we pass in the user-data, at what point is that data transmitted to the VM (is this a Xen feature) and where is it stored?
我首先想到的,它被设置为USER_DATA的环境变量,但我们也可以把它作为一个文件。哪里该文件存储在哪里?它是通用的所有实例或取决于AMI?
I first thought, it was set as the USER_DATA env var, but we can also pass it as a file. Where is that file stored? Is it generic to all instances or varies depending on AMI?
这是不是本身,只是想知道亚马逊是如何做到这一点的一个问题。
This is not a problem per se, just wanted to know how Amazon does this.
用户数据截图: http://d.pr/GZlY
推荐答案
用户数据可与在此URL一个简单的HTTP请求的实例:
The user-data is available to the instance with a simple HTTP request at this URL:
http://169.254.169.254/latest/user-data
亚马逊EC2并没有把这个用户数据的情况下直接,但许多的AMI有code,指示的情况下自动下载并处理用户数据。
Amazon EC2 does not put this user-data on the instance directly, though many AMIs have code that instructs the instance to download and process the user-data automatically.
另请参阅:
HTTP://docs.aws.amazon .COM / AWSEC2 /最新/ UserGuide /用户data.html
这篇关于亚马逊EC2的用户数据,它是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!