Score:4

In AWS, can an EC2 instance be in more than one VPC at the same time?

lk flag

I think the answer is no, but I want to make sure that I'm not missing anything. Is it possible for an EC2 instance to have IP addresses in more than one VPC at the same time?

I tried creating 2 VPCs, and then two network interfaces, one in each VPC, but it seems it's not possible to attach them to the same EC2 instance because it's not possible to attach them to an instance that's not on that VPC, is this correct?

For example, I create vpc1 and eni1 (network interface) in vpc1. Then I create vpc2 and eni2 in vpc2. Then I create ec21 (an EC2 instance) and put it in vpc1 with eni1 as its network interface. When I open eni2 and I select attach, I can't select ec21, it says:

No running or stopped instances in us-esat-1f in vpc2.

Tim avatar
gp flag
Tim
You might find VPC sharing interesting or useful: https://aws.amazon.com/blogs/networking-and-content-delivery/vpc-sharing-a-new-approach-to-multiple-accounts-and-vpc-management/
Score:4
in flag

No, that is not possible

Network interfaces can only be attached to instances in the same VPC as the interface.

Amazon VPC FAQs

Your ec2 instance is bound to the VPC of its primary network interface. If you want cross VPC connection you need to setup VPC peering or VPN.

A ec2 instance can have multiple network interfaces in multiple subnets but they must all be in the same VPC.

mangohost

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.