How to assign internal hostnames to Fargate internal services?

in flag

I'm using CDK (via the Typescript lib) to setup my network infrastructure on ECS. There are some background workers that often report errors to a Slack channel and I'd like to assign random hostnames based on their names, something like worker-<generated-name>.internal or web-<generated-name>.internal.

These don't have ELB or anything, they're internal services with no exposure to the web. But I still would like to have better names than ip-10-10-10-10.internal on my monitoring tools.

cn flag
I suspect there will be just as many people advocating for this as against it. I don't like it myself, but I also don't like a lot about AWS. This data is useless and isn't consumable or cross-referenceable to other sources.
in flag
I'm mainly interested in understanding what type of service is it based on the hostname. It does sound like something useful to me, but I'm open to alternatives, considering my monitoring tool (Appsignal) identifies the hosts by their hostnames.
in flag
Also is this a question appropriate to server fault or stack overflow? If this is the wrong place to ask, please close the question.
id flag

You can set the hostname for tasks on ECS: (search for hostname)

However it is apparently not available for tasks with awsvpc network mode, which in turn means that it won't work for Fargate tasks. Only on those running on ECS hosts.


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.