Flink taskmanager on ECS cannot connect to jobmanager on EC2

Today I discovered why this wasn't working.

The jobmanager was configure with:

jobmanager.rpc.address: localhost

and so, whilst listening on the right rpc port, was not accepting traffic to any other address.

When I changed it to match the taskmanager:

jobmanager.rpc.address: ip-xxx-xx-x-xxx.ec2.internal

then the task manager connected immediately.