AmazonEC2推出与用户数据 [英] AmazonEC2 launch with userdata

查看:273
本文介绍了AmazonEC2推出与用户数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果使用用户数据,当启动一个EC2实例始终是一个字符串?不能说是一个字节数组?  的Java API:我用ec2Client.runInstance(TEST_IMAGE_ID,instanceType,USER_DATA);

Should the Userdata when launching an ec2 instance always be a String? Cant that be a byte array? Java API: I use ec2Client.runInstance(TEST_IMAGE_ID, instanceType, "USER_DATA");

推荐答案

据的亚马逊

用户数据必须被提交到API之前的Base64 EN codeD。该API的命令行工具进行base64编码为您服务。这些数据是在Base64和正在被psented到实例$ P $之前去codeD。

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.

您需要了解您的Java API完成此基础-64编码,你或者你必须自己做。 [参见下面马特索尔尼特的评论。]

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.]

在任何情况下,要小心,你不超过16KB的用户数据的极限。

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

这篇关于AmazonEC2推出与用户数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆