A module that creates a basic transparent HTTP Proxy with API Gateway.
Useful for things like solving CORS issues when developing for a third-party API.
Make sure you have a Route53 Hosted Zone set up already.
module {
source = "direct-democracy-solutions/http-proxy/aws"
version = "1.0.0"
api_display_name = "example-dot-com-proxy"
api_description = "Transparent proxy to example.com"
target_url = "http://example.com"
api_mapping_key = "" # Set this if you want to proxy only the part of the path after a certain prefix
full_domain_name = "mycoolproxy.mydomain.com" # The proxy will be addressable here
hosted_zone_id = "23AOIPODTNI98" # Replace with your own hosted zone ID
}
The module will create a proxy gateway at the requested location, with a valid TLS certificate. Logs are streamed to CloudWatch.
To integrate with something other than an HTTP service, pass the variable
auto_create_route=false
and omit target_url
. Then you can define your
own aws_apigatewayv2_route
and aws_apigatewayv2_integration
objects.
To attach them to the API Gateway, use the module's api_id
output.