Home > other >  Which aws service to use. Ec2 or ecs for docker [closed]
Which aws service to use. Ec2 or ecs for docker [closed]

Time:09-17

I am new in docker . So we have shifted our web applications from bitnami to docker and we have to deploy that project in web. So I want to know for this which service to use aws EC2 or Ecs. For example - should I select EC2 instance and install docker there and setup project there or use docker image in ecs and use project only in EC2.

I am completely new so please guide me.

CodePudding user response:

Docker images/containers can be run on EC2, but better to use some container orchestration service for an entire application. Below goes the steps to run docker cotainer on EC2 -

Launch EC2 instance

Install docker

Run docker container

Step by step guide can be found here

But for an entire application where there will be so many containers running, you have to use some container orchestration software like kubernetes or ECS.

Suggesting you to please go through this awesome AWS document on container deployment using ECS

CodePudding user response:

TL/DR: explore App Runner and if that doesn't work for you stick to ECS.

Longer rant:

As others have said it's not an "either or". ECS uses EC2 to run the containers. What ECS does is adding a level of orchestration so that you do not need to coordinate/monitor/wire the containers yourself (this becomes a real problem as soon as you start using 2 EC2 instances for scale and/or high availability reasons).

Unless your use case is so simple that running manually containers on EC2 is the best course of action, my suggestion is to 1) use ECS and 2) leverage Fargate instead of EC2 (you can read this blog for some additional historical background on the progression from EC2 -> ECS/EC2 -> ECS/Fargate)

This StackOverflow thread may help you decide what tool/interface to use to deploy to ECS (my rough suggestion given where you are: use Copilot).

One other option to explore if you want a complete managed experience would be to use App Runner. It leverages ECS/Fargate in the back but it provides an all-wired / fully managed experience to run stateless web containers. You can bring your own docker image (or you can bring your GH repo - Python/Node - and it will build the image for you). Note App Runner is only suited (for now) for web/api applications (not workers etc) but if that fits your app profile App Runner is your best bet IMO.

  • Related