I'm diving into setting up Azure DevOps agents within an EC2 Auto Scaling Group, and I've been reading through a helpful post on AWS's blog. One topic I'm unclear about is the benefits of using EventBridge combined with an SSM document for installing and starting the agent. I feel like this could also be accomplished using EC2 user data. Is there a specific advantage of opting for SSM documents over just using user data in this situation?
4 Answers
While I don't directly work with Azure DevOps agents, creating a base image with the agent pre-installed could be another solid option. It saves time at startup by avoiding the setup during each boot.
Both methods are viable, but I’ve noticed user data generally runs faster than SSM scripts because they rely on the SSM agent to be set up correctly. If speed is crucial for your deployment, keep that in mind!
Using SSM documents can really streamline things like centralized management and logging. Plus, if something goes wrong, SSM has built-in retry functions. User data runs once at boot, which makes SSM more reliable for managing a fleet of instances.
That makes a lot of sense! But what if I only want the script to execute a single time? Would user data be more appropriate then?
Exactly! If you're okay with one-time execution, user data is a solid option for that use case.
Yeah, you can definitely use user data, but it's a bit more delicate. While it's straightforward, if something goes wrong during the execution, it doesn't have the same reliability measures as SSM. They're using EventBridge and SSM for control and an extra layer of dependability.
Could you elaborate on how user data might be fragile? Are there scenarios where it might fail to run?
That's a good point! If there’s a dependency issue during startup, user data may not execute correctly.

I had the same thought! But I really wanted to explore the differences after reading the docs, which is how this question popped into my head. 🙂