By using AWS re:Post, you agree to the Terms of Use
/How to Design or Architect/

How to Design or Architect


Hi Team

I need to know what strategy we should use when we try to upgrade an agent on a running ec2. In order to follow cloud standards what i did is. i created an AMI and that has got my agent installed, so any new ec2 made by that AMI is having the agent installed. But when i want to upgrade the agent. how should i go about it?

Which is the best option here:

  1. Code deploy
  2. Code pipeline
  3. Lambda.

or what else should be a good approach to follow?


1 Answers


You could either follow "golden AMI" approach - in this case you create a CI/CD pipeline (e.g CodeBuild/Jenkins/TeamCity/etc) that when your new agent version is build - it triggers rebuild of AMI - either via HashiCorp Packer or EC2 Image builder and you further update your nodes to that latest AMI - you could do that via ASG & Launch Templates.

Another way - if you want just have basic AMI that you've already created - and just update the agent on some basis - you better leverage SSM (AWS Systems Manager) features like Distributor that allows to package and publish software on the managed nodes (you need SSM Agent pre-installed for that and ec2 Profile that allows SSM). Or you could just simply use 'Run command" in SSM and run any script that do the task of updating for you on any number of managed machines.

answered 5 days ago
  • Thanks a lot Aleksandr As you suggested, i am using codepipeline to build AMI. it is working fine when i would need the agent for the first time.. then ec2 created from that AMI would have it.. And when new version of agent is released it would simplu trigger the pipeline and it would create a new AMI. After that when i want to upgrade the agent on existing ec2, how would i do that will new AMI. could you please suggest me on it , or can help me with any doc to follow or any video to explain,. I really need to understand how would we do it. so my current work remains of worth.

    Thanks a lot again for your valuable time please.

    Waiting for your comments.


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