AWS Elastic Container Service – 在多个可用区域中运行服务

我通过ECS运行长时间运行的任务。 容器实例分布在多个可用区域中。 是否可以在ECS中定义,当有一个任务的实例多于一个时,每个任务应该在另一个可用区域(如果可能的话)上运行? 这个function对于高可用性和容错性来说非常棒。 现在有可能我的5个任务都在同一台机器上运行,因此当机器死机时,任务都需要放在调度器的其他地方,这会导致服务停机。

希望你能帮助我。

今天宣布AZ意识到调度,所以这是现在解决

亚马逊博客文章

我面临同样的问题。

目前,我用docker&awscli使用自己的AMI。 我用ec2_Data注入init脚本。 此脚本启动dockersn应用crontabs(用于cloudwatch指标和备份)并初始化警报。

我不想使用私人registry或dockerhub,我正在从S3加载docker图像

s3curl --id clouddocker -- -s --retry 5 --retry-delay 30 URL.gz | gunzip|docker load

用ecs-cli,你可以定义子网。

 >ecs-cli up --help NAME: up - Create the ECS Cluster (if it does not already exist) and the AWS resources required to set up the cluster. USAGE: command up [command options] [arguments...] OPTIONS: --keypair Specify the name of an existing Amazon EC2 key pair to enable SSH access to the EC2 instances in your cluster. --capability-iam Acknowledge that this command may create IAM resources. --size [Optional] Specify the number of instances to register to the cluster. The default is 1. --azs [Optional] Specify a comma-separated list of 2 VPC availability zones in which to create subnets (these AZs must be in the 'available' status). This option is recommended if you do not specify a VPC ID with the --vpc option. WARNING: Leaving this option blank can result in failure to launch container instances if an unavailable AZ is chosen at random. --security-group [Optional] Specify an existing security group to associate it with container instances. Defaults to creating a new one. --cidr [Optional] Specify a CIDR/IP range for the security group to use for container instances in your cluster. Defaults to 0.0.0.0/0 if --security-group is not specified --port [Optional] Specify a port to open on a new security group that is created for your container instances if an existing security group is not specified with the --security-group option. Defaults to port 80. --subnets [Optional] Specify a comma-separated list of existing VPC Subnet IDs in which to launch your container instances. This option is required if you specify a VPC with the --vpc option. --vpc [Optional] Specify the ID of an existing VPC in which to launch your container instances. If you specify a VPC ID, you must specify a list of existing subnets in that VPC with the --subnets option. If you do not specify a VPC ID, a new VPC is created with two subnets. --instance-type [Optional] Specify the EC2 instance type for your container instances.