AWS Elastic Container Service - 複数のアベイラビリティゾーンでサービスを実行する

AWS Elastic Container Service - 複数のアベイラビリティゾーンでサービスを実行する

ECS 経由で長時間実行タスクを実行しています。コンテナ インスタンスは複数のアベイラビリティ ゾーンに分散しています。タスクのインスタンスが 1 つ以上ある場合、各タスクを別のアベイラビリティ ゾーンで実行するように ECS で定義することは可能ですか (可能な場合)? この機能は、高可用性とフォールト トレランスに最適です。現在、タスクの 5 つのインスタンスすべてが同じマシンで実行される可能性があります。そのため、マシンがダウンすると、スケジューラによってタスクがすべて別の場所に配置され、サービスのダウンタイムが発生します。

助けていただければ幸いです。

答え1

今日はAZ対応のスケジュールが発表されたので、これで解決しました

Amazon ブログ投稿

答え2

私も同じ問題に直面しています。

現時点では、docker と awscli で独自の AMI を使用しています。ec2_Data を使用して init スクリプトを挿入します。このスクリプトは、docker を起動し、crontab (cloudwatch メトリックとバックアップ用) を適用して、アラームを初期化します。

プライベートレジストリやDockerhubは使いたくないので、S3からDockerイメージをロードしています

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

答え3

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.

関連情報