Making API Calls to a Salesforce server using a Static IP from a serverless environment in GCP.
--
Prerequisites:
- Basic Understanding of Cloud deployments.
- A Google Cloud Console project.
- Knowledge of deploying Node.js app on GCP App Engine.
- Knowledge of deploying Infrastructure on GCP using Terraform.
- Setting up an Nginx Reverse Proxy Server.
This article illustrates how we set-up a GCP infrastructure that enabled our application deployed on App Engine to make API calls to a server that requested a Static IP for whitelisting.
Why?
We needed to deploy this infrastructure because App Engine is a highly scalable, fully managed serverless platform [1] but does not provide Static IP addresses to make API calls.
We had an application deployed on App Engine that needed to make API calls to a Salesforce server residing at an on-premise location. The requirement was that there be a whitelisted static IP address from where the Salesforce server is being hit. The API was a traditional SOAP API request which returned data specific to each user that logged into the application.
Components
We needed three significant components to make the SOAP API requests successfully.
- A server that was set up as a reverse proxy that routed requests to the correct destination.
- A NAT Gateway with a Static External IP address that made it possible to make API requests over the internet.
- A VPC Connector that allowed communication between our serverless application and our VPC network.
The final architecture would look like this:
The Compute VM, Cloud NAT and VPC connector resided in the VPC network we created in the us-central1 region.
How?
We used Terraform and Google Cloud Foundation Toolkit scripts to deploy our infrastructure. Terraform is the most popular Infrastructure as Code (IaC) tool in…