3

启动 ec2 实例时的 Userdata 是否应该始终是字符串?那不能是字节数组吗?Java API:我使用 ec2Client.runInstance(TEST_IMAGE_ID, instanceType, "USER_DATA");

4

1 回答 1

4

According to Amazon:

The user data must be base64 encoded before being submitted to the API. The API command line tools perform the base64 encoding for you. The data is in base64 and is decoded before being presented to the instance.

You need to find out if your Java API will perform this base-64 encoding for you or if you have to do it yourself. [See Matt Solnit's comment below.]

In any case, be careful that you do not exceed the limit of 16KB for user-data.

于 2011-09-21T01:06:22.023 回答