Software Engineering

How to Share a VPC from one AWS Account to Another


To share a Virtual Private Cloud (VPC) from one AWS account to another, you can use the AWS Resource Access Manager (RAM) service. RAM allows you to securely share your AWS resources with other AWS accounts while maintaining control over the resource permissions.

Here’s a step-by-step guide on how to share a VPC from one AWS account to another:

1. Set up the necessary permissions

In the account that owns the VPC (the sharing account), ensure that you have the required permissions to share the VPC. You need to have the ram:CreateResourceShare and ec2:DescribeVpc IAM permissions.

2. Create a resource share

In the sharing account, use the RAM service to create a resource share. A resource share is a container for sharing resources with other accounts. You can create a resource share using the AWS Management Console, AWS CLI, or AWS SDKs.

3. Add the VPC to the resource share

Once you have created the resource share, add the VPC you want to share to the resource share. Specify the VPC using its Amazon Resource Name (ARN) or its ID.

4. Define the sharing permissions

Specify the AWS accounts that you want to share the VPC with. You can share the VPC with individual accounts or with organizations. You can also define the level of access permissions for the shared VPC, such as read-only or full access.

5. Accept the VPC share in the recipient account

In the recipient account, you need to accept the VPC share invitation. You can do this using the AWS Management Console, AWS CLI, or AWS SDKs. Once accepted, the shared VPC becomes available in the recipient account.

6. Verify and configure network settings

After accepting the VPC share, verify the network settings in the recipient account. Ensure that route tables, security groups, network ACLs, and any other necessary configurations are correctly set up to enable connectivity.

Conclusion

That’s it! The VPC is now shared from one AWS account to another. The recipient account can now use the shared VPC and its associated resources.

It’s important to note that there are some limitations and considerations when sharing VPCs between accounts, such as restrictions on certain VPC features and the need to enable resource sharing for specific AWS services. Be sure to review the AWS documentation for more details and to understand the implications of sharing VPCs across accounts.