Search code examples
amazon-web-serviceskubernetesamazon-ecs

What's the best way to setup a docker based cluster on AWS?


We are building a small micro service architecture which we would like to deploy to AWS. The number of services is growing, so we need solution that allows scaling (horizontal).

What's the best way to build this on AWS? We don't have too much experience with docker, we used EC2 based stuff in the past.

I'm thinking about something like:

  • Use ECR, create a private docker repository. We push release images there.
  • Use ECS to automatically deploy those images.

Is this correct? Or should we go for Kubernetes instead? Which one is better?

Our needs:

  • Automated deployments based on docker images
  • Deploy to test and prod environments
  • Prod cluster should be able to handle multiple instances of certain services with load balancing.

Thanks in advance for any advice!


Solution

  • AWS container service team member here. Agreed with others that answers may potentially be very skewed to personal opinions. If you come in with good AWS knowledge but no container knowledge I would suggest ECS/Fargate. Note that deploying on ECS would require a bit of CloudFormation mechanics because you need to deploy a number of resources (load balancers, IAM roles, etc) in addition to ECS tasks that embeds your containers. It could be daunting if not abstracted.

    We have created a few tools that allows you to offload some of that boiler plating. In order of what I would suggest for your use case:

    • Copilot which is a CLI tool that can prepare environments and deploy your app according to specific patterns. Have a look here
    • Docker Compose integration with ECS. This is a new integration we built with Docker that allows you to start from a simple Docker Compose file and deploy to ECS/Fargate. See here.
    • CDK is a sw development framework to define your AWS infrastructure as code. See here. These are the specific CDK ECS patterns if you want to go down that route.