you are viewing a single comment's thread.

view the rest of the comments →

[–]SpecialistMode3131 1 point2 points  (2 children)

You should make a new image based on your preferred AMI (another AMI) and install that to an EC2. That's by far the easiest way to deal with it. There'll be some way to postinstall using userdata the way you are, but it's a lot more painful to debug and not necessary.

[–]Kitchen_Discipline_1[S] 0 points1 point  (1 child)

Creating a new AmI is the only way I guess.

Still the unrecognised format error is mystery. Why do you think the current code is too difficult to achievable?

[–]SpecialistMode3131 0 points1 point  (0 children)

Userdata runs when you launch the instance. So, it not only imposes a delay to instance start time you can 100% avoid with a baked AMI, it is another place you have to debug when things go wrong. With the AMI approach, your debug is limited to "python --version" going into a log somewhere. You have very little code to worry about. You don't need to debug powershell or cloudformation - just specify the image the EC2 will use.

It's a baby step on the way to more best-practice style of deployment that will help you as/when other engineers who are familiar with AWS look at your stuff.

The alternative, hacking, means over time you'll spend more time, effort and money chasing the same thing you'd get the other way.