ohmgroup
ohmgroup

Reputation: 29

How to place EC2 instance in both public and private subnet?

Is it possible to connect an EC2 instance in AWS VPC to both a private and a public subnet using ENIs? I'm aware of the bastion host concept from public/private subnet communication, but curious as anything that will prevent me from configuring an EC2 instance to reside in both public and private subnets.

Upvotes: 0

Views: 2110

Answers (2)

Lijo Abraham
Lijo Abraham

Reputation: 354

Yes you can have multiple ENI's in different subnets and the same can be associated with a single instance, however the instance will once have a single ENI associated with it(from the OS perspective it will have eth0 and eth1). In this case the instance will assume the role(subnet) of the ENI which the OS is associated with it(it is generally eth0).

Upvotes: 0

Yohan
Yohan

Reputation: 410

Yes you can do it. You simply have to attach two Network interfaces. Those two network interfaces needs to be placed in two subnets. Here is the official documentation for that https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html

Upvotes: 3

Related Questions