0
votes

My application js (SPA) hosted to S3 with public access, and setup EC2 in private subnet with internal load balancer on AWS (can't access by public).

Question: How can application on S3 can connect to internal load balancer on private subnet?

2

2 Answers

1
votes

I can say: it's impossible.

Your SPA is client side (browser) running. So, you need kind of public endpoint.

0
votes

I agree with @Tuan VA, It's impossible what you are asking.

if you want a public website

you need a public load balancer for your EC2

if you want to make your website internal and available only via VPN or direct connect to your on-premise employees.

you can make sure website private as described below:

1. Set up the static website as normal,
2. Add a VPC endpoint for S3,
3. Use a bucket policy to deny all but traffic from your VPC