官术网_书友最值得收藏!

Amazon ECR and ECS

Containers are the new norm. Every single company that I've come across in the last few years is using or considering using containers for their software. This enables us to build software with the microservices principles in mind (small individual software components running independently) as it provides a decent level of abstraction from the configuration and deployment of different apps: basically, the entire configuration is stored in a container and we only need to worry about how to run it.

Amazon, as one of the pioneers of the microservices architectures, has created its own image registry and cluster (service).

As we will see in depth in Chapter 3, Docker, is built around two concepts: images and containers. An image is a definition of an application (configuration + software), whereas a container is an instance of the running image. The image is built through a Dockerfile (a description of the image with a very basic script language) and stored in a registry, in this case, Amazon EC2 Container Registry (ECR), our private registry in the AWS infrastructure. We don't need to worry about availability or managing resources; we just choose the region where our containers are going to run and push our images into that repository.

Then, from our host running Docker, the image is pulled and the container is instantiated. This is simple and effective, but there are a few considerations:

  • What happens when our host does not have enough resources to run as many containers as we want?
  • What happens if we want to ensure the high availability of our containers?
  • How do we ensure that the containers are restarted when they fail (for some reason)?
  • How can we add more hardware resources to our system without downtime?

All those questions were trickier a few years ago but are simple now: Amazon EC2 Container Service (Amazon ECS) will take care of it for us. ECS is basically a cluster of resources (EC2 machines) that work together to provide a runtime for our containers to be executed.

Within ECS, when creating a new service, we specify parameters such as how many replicas of our container should be running at the same time as well as what configuration (image) our container is supposed to use. Let's see how it works.

主站蜘蛛池模板: 黎城县| 绵竹市| 宁阳县| 莒南县| 文登市| 中卫市| 宁海县| 栾城县| 南江县| 清徐县| 息烽县| 中方县| 平遥县| 苏州市| 龙山县| 定结县| 连山| 许昌市| 简阳市| 永顺县| 资兴市| 镇远县| 云浮市| 嘉义县| 丰原市| 辽宁省| 聊城市| 南丰县| 凤阳县| 华阴市| 抚宁县| 房山区| 平罗县| 蓬安县| 沭阳县| 桃园县| 河源市| 茌平县| 乐都县| 宝兴县| 英山县|