Set UserData for RunInstances step function

0

I'm trying to migrate from ModifyInstanceAttribute+StartInstances to RunInstances and I'm stumped for a reason why they use different formats for UserData. Figuring out creating blobAttributeValue was hard enough, but it worked as it does base64 encoding for you. The question is how do I base64-encode UserData for RunInstances in my state machine? What's more, even if I put base64-encoded data in UserData (callback task token), it never shows up in the instance's user data - in Web UI it is shown as "No user data found". Apparently just because the task token decodes into a random binary stream, and it causes problems down the line - I guess AWS tries to parse it to figure out if it's some script to execute and bails out completely.

My main goal is to pass the task token to the EC2 instance I create (along with some other params which I can put in tags separately - it works). But the task token won't fit into a tag, so UserData seems to be the only option. I am at a loss - is it even technically possible to use RunInstances with a callback?

  • Tbh I find the callback mechanism severely restricted at this point - there's no way to use it for anything else other than Lambda where you can put the task token into the event context. There should be a general way to send the task token to SNS/SQS/EventBridge

Vitaly
asked 2 years ago77 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions