This project is read-only.

Base64 Encoded UserData

Dec 3, 2012 at 4:27 AM

The Java AWS SDK expects all userdata to be Base64 encoded. It doesn't look like Base64 userdata is handled by CloudInit.NET. Does it actually handle Base64 and I just missed it or is there an existing extension we can use?

Dec 3, 2012 at 2:16 PM

I've never had to base64 encode the user data not sure why the Java AWS SDK expects userdata to be base64 encoded. The scripts I have aren't base64 encoded and they work fine with the python api, .net and the command line tools. That being said, it wouldn't be too hard to add a setting to CloudInit.NET that allows you to read base64 encoded files.

Dec 3, 2012 at 11:31 PM

Unfortunately, the Java AWS SDK api throws an exception if the userdata is not base64 encoded. It is not a problem for our linux instances as the linux CloudInit detects base64 automatically. I can probably add the functionality to CloudInit.NET but I was hoping someone had already solved the problem as I am primarily a Java developer now and I'm extremely time limited as well. If I was to add the functionality myself I assume the latest version of Visual Studio would be appropriate to use?

Dec 3, 2012 at 11:41 PM

I'll take a look at it tomorrow, if its as easy as I think it is I should be able to make it work easily. I'll let you know if i'm able to fix it or not.

Dec 4, 2012 at 12:49 AM

Brilliant, I appreciate you taking the time.

Dec 4, 2012 at 9:10 PM

I made some modifications to allow you to add a registry setting that will base64 decode the contents of the user-data file before attempting to execute it. Could you provide me an example file so that I can test it before submitting it to the repository?

Dec 4, 2012 at 11:49 PM

The following powershell script

#! /powershell/ 

Write-Output "**** Base64 Decode for CloudInit.NET worked ****" | Out-File "c:\PowershellLog.txt"

converts to the following base64 data




Dec 4, 2012 at 11:49 PM

Thanks again for your time

Dec 5, 2012 at 9:24 PM
Edited Dec 5, 2012 at 9:24 PM

Checked in the changes to source control. You can get the binaries here


Hope this helps, let me know if for some reason it doesn't work for you

Dec 5, 2012 at 9:33 PM

You also need to run the command

reg add HKLM\SYSTEM\CurrentControlSet\services\CloudInit\Settings /v IsBase64Encoded /t REG_DWORD /d 1 

Which will add the required setting in the registry 

Dec 5, 2012 at 11:48 PM

I can see the source code changes but the url for the binaries doesn't work...

Dec 6, 2012 at 4:37 PM

Sorry codeplex is really wierd apparently it has that link private only.

I move the whole project to github since codeplex isn't that great. Here's the new link for the binaries.