I hit an issue while testing ECS Managed Instance, so here's a quick note for future reference.
ECS Exec Fails on a Task Container Running on ECS Managed Instance in a Public Subnet
If you deploy this setup in a public subnet without any special network configuration and run the Exec command, you'll get the following error:
An error occurred ( TargetNotConnectedException ) when calling the ExecuteCommand operation: The execute command failed. TargetNotConnected: ecs:ecs-task_xxxxxxxxxxxxxxxx is not connected.
Enter fullscreen mode
Exit fullscreen mode
Network Considerations for ECS Managed Instance
The blog post linked below covers this in detail, but it appears that with ECS Managed Instance, you cannot assign a public IP to a task using assignPublicIp=ENABLE .
https://zenn.dev/gsk9999/articles/0da047d2cc3b59
When Task Instances Are Placed in a Public Subnet
Here is what you can do:
Create a VPC Endpoint
I confirmed this works with my own testing.…