How to configure hostname in ECS Fargate task definition

Sunil Shakya picture Sunil Shakya · Feb 15, 2018 · Viewed 7.1k times · Source

We are migrating from ECS to Fargate. In ECS, we could set the hostname in the task definition like this:
"hostname": "%HOST_NAME%"

It fails to create with the error 'hostname is not supported on container when networkMode=awsvpc' Is there any way to set hostname ?

Answer

Pavel picture Pavel · Oct 18, 2018

AWS documentation says The hostname parameter is not supported if using the awsvpc networkMode. Anything but awsvpc is not supported with FARGATE, therefore there is no way to set hostname in task definition with FARGATE launch type.