I have an EC2 ubuntu machine (g5.large). I registered the machine as an external instance on ECS. I created Task definition, cluster, etc... Did a couple of testing runs and everything went fine.
Than I created new cluster with new EC2 (same configs and settings as above) and suddenly I can't run any task definition.
I get this error: CgroupError: Agent could not create task's platform resources
Solved!
echo "GRUB_CMDLINE_LINUX=systemd.unified_cgroup_hierarchy=false" | sudo tee /etc/default/grub.d/cgroup.cfg
sudo update-grub