How to Install an Existing ECS ​​Cluster in a Compute Environment in an AWS Package

I have ECS cluster

one running in my environment and it is configured with tasks, repos and services, and autoscaling.

I open a service AWS Batch

and when I create a new one compute environment

, a new cluster is added to the service ECS

. I want to know how to install compute environment

into my already existing cluster?

+3


source to share


1 answer


According to my knowledge (spent half a day studying the documentation and forums) this is not possible. computeEnvironments

ecsClusterArn

assigned immediately after the creation of the computing environment and cannot be changed.

Interestingly, Batch somehow changes /etc/ecs/ecs.config

to newly instantiated instances in CE managed:



... // config from my AMI ECS_CLUSTER=my_cluster_name ... // ECS_CLUSTER={ENVIRONMENT NAME HERE}_Batch_{RANDOM UUID HERE} ECS_DISABLE_IMAGE_CLEANUP=false ECS_ENGINE_TASK_CLEANUP_WAIT_DURATION=2m ECS_IMAGE_CLEANUP_INTERVAL=10m ECS_IMAGE_MINIMUM_CLEANUP_AGE=10m ECS_NUM_IMAGES_DELETE_PER_CYCLE=5 ECS_RESERVED_MEMORY=32 ECS_AVAILABLE_LOGGING_DRIVERS=["json-file","awslogs"]

, and the first is ECS_CLUSTER

wiped by the second. It looks like a predefined one user-data

, but I couldn't find where to change it.

However, perhaps you can achieve the original purpose of using the inverse approach - to create an unmanaged CE and enumerate the instances that you want to be in the CE, change ECS_CLUSTER

in /etc/ecs/ecs.config

to $that_autogenerated_CE_arn

, restart ecs-agent

(or the corresponding docker, if this is not Amazon Linux). Now your containers belong to a different cluster and only the difference is in the cluster name.

0


source







All Articles