Last active
November 25, 2022 06:39
-
-
Save bugb/91e811a783190d88f183c61cc8ad9ff3 to your computer and use it in GitHub Desktop.
Allocate ECS agent to another ECS cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo -s | |
service ecs stop | |
docker stop ecs-agent | |
docker rm ecs-agent | |
mv /var/lib/ecs/data/agent.db{,.bak} | |
sed -i 's/Prod-BC-ECS-ElasticSearch-Standard-C1/Prod-BC-ECS-ElasticSearch-Premium-C1/g' /etc/ecs/ecs.config | |
echo -e 'ECS_DATADIR=/data\nECS_ENABLE_TASK_IAM_ROLE=true\nECS_ENABLE_TASK_IAM_ROLE_NETWORK_HOST=true\nECS_LOGFILE=/log/ecs-agent.log\nECS_AVAILABLE_LOGGING_DRIVERS=["json-file","awslogs"]\nECS_LOGLEVEL=info' >> /etc/ecs/ecs.config | |
echo "ecs config is: " | |
cat /etc/ecs/ecs.config | |
docker pull public.ecr.aws/ecs/amazon-ecs-agent:latest | |
docker run --name ecs-agent \ | |
--detach=true \ | |
--restart=on-failure:10 \ | |
--volume=/var/run:/var/run \ | |
--volume=/var/log/ecs/:/log \ | |
--volume=/var/lib/ecs/data:/data \ | |
--volume=/etc/ecs:/etc/ecs \ | |
--volume=/etc/ecs:/etc/ecs/pki \ | |
--net=host \ | |
--env-file=/etc/ecs/ecs.config \ | |
amazon/amazon-ecs-agent:latest | |
# docker logs -f ecs-agent | |
service ecs start | |
service ecs status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment