Skip to content

Help with Hosted Website on EC2 to access Private API within same VPC

0

Dear all, I built a VPC, and it has a hosted Website on EC2, and an API Gateway (Private). I realize that Private API can only be accessed by instances within the same VPC. When I open EC2 instance and connect, I can curl my API (within the terminal), however when I open my hosted website on EC2, it says ERR_NAME_NOT_RESOLVED.

Additionally, my hosted website is using HTTP instead of HTTPS. I have HTTPS in my inbound rule, however it is not changing into HTTPS.

Please kindly for the help

2 Answers
0

Is your domain set up incorrectly?
Have you correctly configured EC2 with a public domain?
Also, how do you set up SSL certificates?

EXPERT

answered 3 years ago

0

If I make the following assumptions:

  • Your VPC is configured with various subnets either configured as public or private.
  • Your EC2 instance is installed in one of the public subnets. From your description, it appears that your VPC, EC2 and API Gateway function are configured correctly. First I would ask the following questions:
  1. Is your EC2 instance have an Elastic IP address assigned to it?
  2. Do you have a domain that you have control over the DNS server for it?

The issue you describe indicates that your EC2 instance doesn't have an Elastic IP and your DNS configuration is not set up (or hasn't propagated) yet. For your HTTP conversion, you would have to configure the webserver to redirect traffic from HTTP to HTTPS and have a valid SSL certificate.

As an alternative, you could use the API gateway as a proxy to your EC2 instance and then apply the SSL certificate to the API Gateway.. This would also allow you to deploy your EC2 instance in a Private subnet and not need an Elastic IP address.

Hope this helps,

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.