本文介绍了如何将我的自动缩放组连接到我的 ecs 集群?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 ECS 的所有教程中,您需要创建一个集群,然后创建一个自动扩展组,这将产生实例.不知何故,在所有这些教程中,实例神奇地出现在集群中,但没有人给出连接自动缩放组和集群的提示.

In all tutorials for ECS you need to create a cluster and after that an autoscaling group, that will spawn instances. Somehow in all these tutorials the instances magically show up in the cluster, but noone gives a hint what's connecting the autoscaling group and the cluster.

我的自动缩放组按预期生成实例,但它们只是没有出现在我的 ecs 集群上,它保存着我的 docker 定义.

my autoscaling group spawns instances as expected, but they just dont show up on my ecs cluster, who holds my docker definitions.

我缺少的连接在哪里?

推荐答案

好吧,我发现了.它是关于 ecs-agent 及其配置文件/etc/ecs/ecs.config(此文件将通过 Userdata 字段创建,在创建 EC2 实例时,甚至从自动扩展配置中创建.)在此处阅读其配置选项:http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html

Well, i found out.Its all about the ecs-agent and its config file /etc/ecs/ecs.config(This file will be created through the Userdata field, when creating EC2 instances, even from an autoscaling configuration.)Read about its configuration options here: http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html

但您甚至可以复制存储在 Amazon S3 上的 ecs.config,这样做(以下几行进入 Userdata 字段):

But you can even copy a ecs.config stored on Amazon S3, do it like this (following lines go into Userdata field):

#!/bin/bash
yum install -y aws-cli
aws configure set default.s3.signature_version s3v4
aws configure set default.s3.addressing_style path
aws configure set default.region eu-central-1
aws s3 cp s3://<bucketname>/ecs.config /etc/ecs/ecs.config

注意:Signature_version v4 特定于某些区域,例如 eu-central-1.如果您的实例的 IAM 角色(在我的例子中是它的 ecsInstanceRole)具有正确的 AmazonS3ReadOnlyAccess

AWS GUI 控制台方式为:在 https://console.aws.amazon.com/ecs/home 上使用集群向导#/firstRun .它将为您的集群创建一个自动缩放组,在它前面创建一个负载均衡器,并将它们连接起来.

The AWS GUI console way for that would be:Use the cluster wizard at https://console.aws.amazon.com/ecs/home#/firstRun .It will create an autoscaling grou for your cluster, a loadbalancer in front of it, and connect it all nicely.

这篇关于如何将我的自动缩放组连接到我的 ecs 集群?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 12:38