Reputation: 769
I have a "Custom VPC" with two subnets (A private subnet & a public subnet).
In ECS, when I try and create a cluster with "Custom VPC" and both subnets selected. The EC2 instances launched, are by default launched in the private subnets.
Upvotes: 0
Views: 2223
Reputation: 627
Every instance in a VPC has a default network interface, called the primary network interface (eth0). You cannot detach a primary network interface from an instance. You can attach a new network interface.
To change the subnet of launched EC2 instance, you can follow this steps:
You can reference to this document for how to create and attach a new network interface for an EC2 instance. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html
Upvotes: 0
Reputation: 1121
1: You need run ECS in the public subnets reference : https://docs.aws.amazon.com/AmazonECS/latest/developerguide/get-set-up-for-amazon-ecs.html
2: Yes or you need to create a private subnet with NAT gateway tied to it
Upvotes: 0