Accessing Google API over CEN

Prerequisites

  1. Alibaba Cloud Account
  2. 2 VPC’s one in China Region and the other in the International region. We have considered Beijing and London in this document
  3. 2 ECS instances 1 in Beijing VPC and the other in the London VPC
  4. CEN Configuration Across the two VPC’s
  5. Access to Google APIs for testing. We are using the Google Texttospeech API and the Google Translate API for the test.

Architecture Overview

  1. The VPC in Beijing hosts an ECS instance running Centos 7 which will be the client machine wanting to access the Google APIs
  2. The VPC in London hosts an ECS instance running Centos 7 and Apache 2.4.6
  3. The VPC in London connects to Google API’s over standard Internet

Initial Setup

  1. The IP for the ECS instance in Beijing is 192.168.0.201
  2. The IP for the ECS instance in London is 172.16.0.31

Install and Configure Apache

Install Apache on the Centos Server in London

  1. mod_proxy, the main proxy module Apache module for redirecting connections; it allows Apache to act as a gateway to the underlying application servers.
  2. mod_proxy_http, which adds support for proxying HTTP connections.
  3. mod_proxy_balancer and mod_lbmethod_byrequests, which add load balancing features for multiple backend servers.

Configure Apache for Reverse Proxy

Setup two virtual hosts one for the “Google Translate API” and another for the “Text-to-Speech” API

Conclusion

In this article, we showed the configuration for accessing Google API’s from Alibaba Cloud in China using Cloud Enterprise Network (CEN). However this exercise has been created for users who are using googleapi to host their custom API’s outside China and want to use the same API’s in China. You are recommended to move the API’s to Alibaba Cloud API Gateway in the long term.

Further Reading

Apache Reverse Proxy Guide

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com