Motivation / Why?
There are times that you just need to spin up a server quickly, experiment with something and etc… but you need an HTTPS secure connection. (e.g. WebRTC signaling calls, webhook requests)
In this article, we’re gonna use AWS API Gateway proxy in order to have an HTTPS connection for our API deployed on an EC2 instance.
There are some articles and tutorials out there which use a load balancer (ALB/NLB), VPC Link to achieve this same goal, but they would cost you extra money which we can easily avoid.
Steps / How?
۰٫ I assume you have an API deployed on an EC2 instance ready at
1. Log in to the AWS console and go to the API gateway service.
HTTP API and click
4. In the first step of creating an API Gateway, you need to add two integrations:
1. HTTP | ANY |
2. HTTP | ANY |
The first one is for matching this route
http://xa.yb.zc.dd without any trailing slash and the second one is for a catch-all/wildcard behavior.
۵٫ In the second step enter these values to map API gateway routes to integrations:
1. $default |
2. ANY |
۶٫ Configure stages and create the API gateway
Now you have an HTTPS proxy ready for your EC2 instance, hope this was helpful to you.
Please leave a comment if you had any challenges, issues setting this up, or a better solution to achieve this goal.