- Newest
- Most votes
- Most comments
It sounds like you're encountering a common issue with AWS App Runner when using a custom VPC for outgoing traffic. When you connect your App Runner service to a VPC, by default, the outbound traffic doesn't have access to the public internet. All outbound traffic from your application is directed through the VPC that your service is connected to, and all networking rules for the VPC apply to the outbound traffic of your application.
To resolve this issue and enable your App Runner service to access both your database in the custom VPC and external URLs on the public internet, you have a few options:
-
Connect the subnets to the internet through a NAT Gateway: This allows your App Runner service to access the internet while still maintaining the connection to your custom VPC. You'll need to set up a NAT Gateway in your VPC and configure your route tables accordingly.
-
Set up VPC endpoints for the AWS services that you need to access: If you're trying to access other AWS services, you can use AWS PrivateLink to create VPC endpoints. This allows your service to stay within the Amazon VPC while accessing these services.
-
Use a combination of public access and VPC access: While you mentioned this isn't ideal, it's worth noting that App Runner allows you to configure both public internet access and VPC access simultaneously. This could be a temporary solution while you set up a more permanent one.
If you've already ensured that your security groups and NACLs are correctly configured to allow outbound traffic, the most likely solution is to set up a NAT Gateway. This will allow your App Runner service to initiate outbound connections to the internet while still maintaining the ability to connect to your database within the custom VPC.
Remember to check your VPC's route tables after setting up the NAT Gateway to ensure that internet-bound traffic is being directed to the NAT Gateway.
If you continue to experience issues after implementing these solutions, you may want to double-check your VPC configuration, ensure that your subnets are correctly set up, and verify that there are no conflicting security group or NACL rules blocking outbound traffic.
Sources
Enabling VPC access for outgoing traffic - AWS App Runner
Using App Runner with VPC endpoints - AWS App Runner
Networking with App Runner - AWS App Runner
Relevant content
asked 2 years ago

This makes sense. The vpc currently routes 0.0.0.0/0 to an internet gateway. There are no options for public and private routes. Can I add 0.0.0.0/0 route to a nat gateway as well? Will this stop the internet gateway working?