how to perform ecs exec

preview_player
Показать описание

How to perform exec to container running on aws Fargate.

Step -1 When you create task definitions for your service add the role which contain the policy of SSMExec

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssmmessages:CreateControlChannel",
"ssmmessages:CreateDataChannel",
"ssmmessages:OpenControlChannel",
"ssmmessages:OpenDataChannel"
],
"Resource": "*"
}
]
}

After the service is started perform update-service operation with the flag --enable-execute-command

aws ecs update-service --cluster clusterName --service serviceName --region regionName --enable-execute-command --force-new-deployment

Wait for the new Deployment takes place, once the task is running you can exec

aws ecs execute-command --cluster cluster-name \
--task task-id \
--container container-name \
--interactive \
--command "/bin/sh"
Рекомендации по теме
Комментарии
Автор

why am i getting "Invalid choice" with execute-command ...

minhnguyenba
Автор

I'm trying to follow the steps but probably I missed something and what is not clear to me is the task definition: which task role did you choose from in the task definition and which execution role?
Is it possible to connect with ecs exec to a task running in the Cluster without creating a service as shown in the video?

mrkey-music