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

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.

主站蜘蛛池模板: 余姚市| 尖扎县| 廊坊市| 银川市| 常山县| 天等县| 正阳县| 宝丰县| 凤城市| 永安市| 登封市| 泰来县| 镇宁| 江西省| 中西区| 理塘县| 三河市| 商水县| 大埔区| 确山县| 沁源县| 江油市| 扶余县| 诸城市| 江北区| 清镇市| 巧家县| 金昌市| 景宁| 修武县| 邳州市| 手机| 新安县| 邯郸县| 灵山县| 桐乡市| 凤山市| 封开县| 贡觉县| 西城区| 五指山市|