ECS agent not available on Amazon ECS optimised AMI


AMI ID: amzn2-ami-ecs-hvm-2.0.20200115-x86_64-ebs (ami-03f05a4c7314d92be)
Symptom: from console, see attached file. When click on 'update agent' button, it came back with 'There is no update available for your container agent.'

SSH onto the EC2 Instance

$ sudo yum update -y ecs-init
Loaded plugins: priorities, update-motd, upgrade-helper
amzn2-core                                                                                                                                                                                                                                               | 2.4 kB  00:00:00     
No packages marked for update
[ec2-user@ip-10-215-20-34 ~]$ service docker restart && sudo start ecs
Redirecting to /bin/systemctl restart docker.service
Failed to restart docker.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and 'systemctl status docker.service' for details.
[ec2-user@ip-10-215-20-34 ~]$ which ecs-init
/usr/bin/which: no ecs-init in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/ec2-user/.local/bin:/home/ec2-user/bin)
[ec2-user@ip-10-215-20-34 ~]$ sudo docker -v
Docker version 18.09.9-ce, build 039a7df

So ecs-init is missing from this AMI

Edited by: Nemoisme on Feb 12, 2020 5:15 AM
Edit for clarity and add references

asked 4 years ago643 views
1 Answer

AMI ID: amzn2-ami-ecs-hvm-2.0.20200115-x86_64-ebs (ami-03f05a4c7314d92be)
I add this role 'AmazonEC2ContainerServiceforEC2Role' to the ECS Task Executioner (Cloud Formation ECS service stack). Delete and rerun create-stack

    Type: AWS::IAM::Role
      Path: /
        Version: 2012-10-17
          - Action: sts:AssumeRole
            Effect: Allow
        - arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy
        - arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role

(ssh onto the instance, then)
2 install ecs and starts it
$ sudo amazon-linux-extras install -y ecs
$ sudo yum update -y ecs-init
Loaded plugins: priorities, update-motd, upgrade-helper
No packages marked for update
The way in to start ecs doesn't work for me.

$ service docker restart && sudo start ecs
sudo: start: command not found

3 Test launching tasks
From AWS ECS Console, I then manually launched new task like the one created & stopped by CF stack.

  1. The tasks stopped again.
    Task failed to start
    Nginx, webapp tasks does have any Cloud Watch Log. But mysql task does ping down to some settings problem, so I fixed it there.
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions