Search code examples
dockeramazon-ec2microservices

Feasibility of choosing EC2 + Docker as a production deployment option


I am trying to deploy my microservice in EC2 machine. I already launched my EC2 machine with Ubuntu 16.04 LTS AMI. And also I found that we can install Docker and run containers through Docker installation. Also I tried sample service deployment using Docker in my Ubuntu. I successfully run commands using -d option for running image in background also.

Can I choose this EC2 + Docker for deployment of my microservice for actual production environment? Then I can deploy all my Spring Boot microservice in this option.

I know that ECS is another option for me.To be frank trying to avoid ECR, ECS optimized AMI and its burdens, Looking for machine with full control that only belongs to me.

But still I need to know about the feasibility of choosing EC2 + Docker through my Ubuntu machine. Also I am planning to deploy my Angular 2 app. I don't need to install, deploy and manage any application server for both Spring Boot and Angular, since it will gives me about a serverless production environment.


Solution

  • What you are describing is a "traditional" single server environment and does not have much in common with a microservices deployment. However keep in mind that this may be OK if it is only you, or a small team working on the whole application. The microservices architectural style was introduced to be able to handle huge, complex applications with large development teams that require to scale out immensely due to fast business growth. Here an example story from Uber.

    Please read this for more information about how and why the microservices architectural style was introduced as well as the benefits/drawbacks. Now about your question:

    "Can I choose this EC2 + Docker for deployment of my microservice for actual production environment? "

    Your question can be simply answered: You can, but it is probably not a good idea assuming you have a large enough project to require a microservices architecture.

    You would have to implement all of the following deployment aspects yourself, which is typically covered by an orchestration system, like kubernetes:

    1. Service Discovery and Load Balancing
    2. Horizontal Scaling
    3. Multi-Container Application Deployment
    4. Container Health-Management / Self-Healing
    5. Virtual Networking
    6. Rolling Updates
    7. Storage Orchestration

    "Since It will gives me about a serverless production environment to me."

    EC2 is by definition not serverless, of course. You will have to maintain your EC2 instances, including OS updates, security patches etc. And if you only have a single server you will have service outages because of it.