I achieved this by overriding the container command to write to /etc/hosts before executing the main task.
For example, sh,-c,echo 127.0.0.1 somehostname >> /etc/hosts && your-real-server
See also https://github.com/aws/containers-roadmap/issues/1076#issuecomment-692622717