简体   繁体   English

AWS ECS + EFS + Spot 实例

[英]AWS ECS + EFS + Spot instances

I am thinking about using an ECS cluster based on spot instances.我正在考虑使用基于 Spot 实例的 ECS 集群。 In order to keep containers' data save, I want to use EFS, so all instances will be connected to it and all containers will store their data on EFS.为了保存容器的数据,我想使用 EFS,所以所有实例都将连接到它,所有容器都将它们的数据存储在 EFS 上。 In this case, even if an instance is terminated, the data will be untouched on EFS, When a new instance is relaunched all containers will get their data mounted.在这种情况下,即使实例终止,EFS 上的数据也不会受到影响,当重新启动新实例时,所有容器都将挂载它们的数据。

It is just an idea, will it work?这只是一个想法,它会起作用吗? Are there any cons?有什么缺点吗?

Yes it will work.是的,它会起作用。

Steps:脚步:

  1. Create an empty ECS cluster创建一个空的 ECS 集群
  2. Create an Elastic file system (EFS)创建弹性文件系统 (EFS)
  3. Create a launch template创建启动模板
  4. Set the 'UserData' script to attach each instance to the ECS Cluster and the EFS设置“UserData”脚本以将每个实例附加到 ECS 集群和 EFS
  5. Take care of security group rules to allow access to EFS from Cluster EC2 instance注意安全组规则以允许从集群 EC2 实例访问 EFS

Example: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/example_user_data_scripts.html示例: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/example_user_data_scripts.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM