Issue
I had an app setup a couple years ago and this worked smoothly, without using CloudWatch or AWS Events. I would push a built docker image from Semaphore CI to my ECR, and my EC2 Auto Scaling Group would immediately terminate the current EC2 instance and start a new one running the new image.
Returning to my project after a couple years it seems I can still push to ECR but the ASG does not restart with a new EC2 instance using the new image.
How is it possible to achieve this behavior? Here is the same question asked previously but the answer seems much more involved than is necessary or than what I was using before (which I can't quite remember :)
How to let EC2 instance know when new image pushed to ECR
--- edit
I have realized I was using EB (Elastic Beanstalk) to manage the EC2s! I believe that was responsible for handling the new images. Still looking into this.
Solution
Answer for anyone reading this I realized I had been using EB to manage the EC2 infrastructure. You push a docker image to ECR, and then make a Dockerrun.aws.json file with the image's url and zip that and push it to an S3 bucket. Then you run:
aws elasticbeanstalk create-application-version
and aws elasticbeanstalk update-environment
.
More details in: https://docs.semaphoreci.com/examples/deployment-to-aws-elastic-beanstalk/
Answered By - Henry Answer Checked By - Mildred Charles (WPSolving Admin)