Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AmazonEC2 launch with userdata

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");

like image 407
Satish Avatar asked Feb 16 '26 08:02

Satish


1 Answers

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.

like image 145
Eric Hammond Avatar answered Feb 18 '26 13:02

Eric Hammond



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!