亚马逊EC2的用户数据,它是如何工作的?亚马逊、它是、数据、用户

2023-09-11 08:08:44 作者:紫色蒲公英

我们开始实例,并访问用户数据,我们的地方。但是,有谁知道这个操作的内部(从亚马逊的一侧)?当我们在传递用户数据,在什么点是传送到虚拟机的数据(这是一个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/latest/UserGuide/ec2-instance-metadata.html

HTTP://docs.aws.amazon .COM / AWSEC2 /最新/ UserGuide /用户data.html