- Newest
- Most votes
- Most comments
Hello.
Lightsail's VPC peering can only use the default VPC.
https://docs.aws.amazon.com/lightsail/latest/userguide/lightsail-how-to-set-up-vpc-peering-with-aws-resources.html
The VPC running Lightsail is managed by AWS, so the Transit Gateway settings answered by AWS re:Post Agent cannot be used.
Also, with VPC peering, you cannot communicate with a VPC that does not have a peering connection with your VPC, so in the case of Lightsail, you can only communicate with the default VPC.
https://docs.aws.amazon.com/vpc/latest/peering/vpc-peering-basics.html#vpc-peering-basics-multiple
Therefore, if you want to allow connections from Lightsail to multiple VPCs, I think it is a good idea to configure PrivateLink.
First, set up VPC peering with your default VPC and Lightsail VPC.
Then configure NLB.
When configuring NLB, set the private IP address of your Lightsail instance as the target.
After setting up NLB, create a VPC endpoint service and create a VPC endpoint for each VPC to communicate from PrivateLink to Lightsail.
https://docs.aws.amazon.com/vpc/latest/privatelink/create-endpoint-service.html
I understand your frustration with connecting a Lightsail instance to a VPC in a different account, even within the same organization. You're correct that Lightsail instances can only be peered with the default VPC in the same AWS account and region. This limitation can indeed be challenging when working across accounts.
Given your situation, here are a few potential approaches you could consider:
-
VPC Peering Chain: Since Lightsail can only peer with the default VPC, you could set up a chain of VPC peering connections. First, peer the Lightsail VPC with the default VPC in its account. Then, set up a cross-account VPC peering between the default VPC in the Lightsail account and your custom VPC in your account. This would create an indirect connection between Lightsail and your custom VPC. However, keep in mind that VPC peering is not transitive, so you'd need to carefully configure routing tables.
-
Transit Gateway: Instead of using VPC peering, you could set up an AWS Transit Gateway. This service acts as a central hub for routing traffic between multiple VPCs and on-premises networks. You can attach both the Lightsail VPC (via its peering with the default VPC) and your custom VPC to the Transit Gateway, enabling communication between them.
-
Migrate Lightsail Resources: If feasible, you could consider migrating the resources from Lightsail to EC2 instances within your custom VPC. This would give you more flexibility in networking configurations, albeit at the cost of losing some of Lightsail's simplicity.
-
API Gateway and VPC Link: For specific use cases, you might be able to use Amazon API Gateway with VPC Link to expose certain services from your VPC to the Lightsail instance without direct network connectivity.
Unfortunately, there isn't a straightforward way to grant shared ownership of a Lightsail instance across accounts or to directly peer a Lightsail VPC with a non-default VPC in another account. The limitations around Lightsail's VPC peering are built into the service's design.
Given your needs for cross-account connectivity, you might want to evaluate if Lightsail is the best fit for your use case in the long term. EC2 instances in a standard VPC might offer more flexibility for your networking requirements, especially when working across multiple accounts within an organization.
Remember to carefully consider security implications and ensure proper IAM permissions are in place when implementing any cross-account solution. If you're still unsure, it might be worth consulting with AWS Support or a cloud architect to design the best solution for your specific needs.
Sources
Community | Connecting Lightsail to AWS Services
VPC peering connections - Amazon Virtual Private Cloud
Connect VPCs using VPC peering - Amazon Virtual Private Cloud
Connect Lightsail resources to AWS services using VPC peering - Amazon Lightsail
answered 2 years ago
Relevant content
asked 2 years ago
asked 3 years ago
- AWS OFFICIALUpdated 6 months ago
