Support multi-host with multi-aws-api via Datawiza
The section talks about how to support multi-host with multi-aws-api in Datawiza Cloud Management Console (DCMC). The network architecture is like this: The request to https://api1.datawiza.com
needs to be proxy passed to AWS API https://api1.execute-api.region.amazonaws.com
. The request to https://api2.datawiza.com
needs to be proxy passed to AWS API https://api2.execute-api.region.amazonaws.com
.
Prerequisite
Both of the domains https://api1.datawiza.com
and https://api1.datawiza.com
should be resolved to the EC2. The Stages
of AWS API1 is test
while the Stage
of AWS API2 is dev
:
Configure in DCMC
First step is to follow the document here to configure the deployment for the first API. Once that’s done, let’s config the second API as below: It is used to proxy pass request to https://api1.datawiza.com
to https://api1.execute-api.region.amazonaws.com
. Now, we will add another application in this deployment which is called api2
. It is used to proxy pass request to https://api2.datawiza.com
to https://api2.execute-api.region.amazonaws.com
: Click Create Application
and input the needed info, click Create
: Click Edit
of api2
.
Click Advanced
tab, open the SSL button and upload the cert and private key. For testing purposes, you can use self-signed cert: In the same tab, input the host of upstream as the Proxy Header Host
. Please contact your administrator to check if SNI is enabled in your upstream environment. You can enable the Upstream SNI option if your API needs it. Failing to configure this correctly may result 502 Bad Gateway
. Click Save
:
That's all, let's check about the result. For API1, visit https://api1.datawiza.com/test:
For API2, visit https://api2.datawiza.com/dev
: