Best approach to deploying container images to fixed EC2 instances


I’ve setup the Drone CI server for my company and started building our services (nodejs & python based) as Docker Container images.

I’m now looking at deploying these container images into existing AWS EC2 Instances. These AWS EC2 instances have their own databases and hence these instances cannot be terminated and recreated.

I tried to the AWS ECS approach and this does not seem to have an option to control to which AWS EC2 instance the code should be deployed. Is my understanding correct?

If yes what is the best approach to deploy the Docker Container images into a fixed AWS EC2 instance. Is it through SSH deployment?


Welcome to the Community, Mani!

Are you using Drone for the build then Harness for the deploy?

Amazon ECS is a container orchestrator in itself; it will spin up and down EC2 nodes dedicated to running your container(s). Are you using ECS?

So you have a running Docker Container on an EC2 instance [not on ECS but one you manage yourself] of the application then the DB running natively or containerized? Reading your post, guessing the app is Dockerized and the DB is running on the EC2 instance as a service.

For a Docker Container-based workload, updating them is a replacement e.g since containers are immutable. Just focusing on one EC2 instance, you will need to stop the running container then re-pull the new image then start the new image so it is a running container.

That type of architecture is a little harder to automatically orchestrate e.g your EC2 node is heterogeneously supporting a container workload and a native application.

Potentially could you wrap these all in an AMI and re-deploy the AMI?



Hi Ravi,

Thanks for your quick response. It great to work with you guys. Yes we’re building our software using Drone CI deployed in our local environment. We’re packaging our services (nodejs & python based) in containers.

The services we initially installed directly in the EC2 instances using separate tmux sessions. We’re trying to move to containers, build automation using Drone CI and deploy automation.

The database is installed in the same EC2 instance as the services.

I was trying to understand if ECS could be used for the deployment through

But like you pointed out ECS orchestrates and controls the creation of EC2 instances.

Wrapping all of the services and database in an AMI could be done for bigger code release cycles. But for patch deployment we wouldn’t want to use that path.

The only way I see right now is to probably use SSH deployment approach using Drone SSH plugins. Then split and DB and services and then start using ECS with Is my understanding correct?

Do you have any other suggestions?

Thanks for help.