Occasionally Elastic Agent creation calls fail with the error Invalid Base64 encoding of user data
All elastic Agent calls succeed with creation of a new Elastic Agent
Occasionally the creation attempt will fail:
The below exception is thrown in the xxxxxxx.log file:
When failed, a new elastic agent call is made and the new agent starts normally.
it looks like when we use ava.util.Base64.getMimeEncoder().encodeToString(userData) to encode the userData for the instance (specifically the keypair generated per-instance) it is occasionally encoded with extra carriage returns which prevent proper decoding by AWS API.