Specific GCP cloud architecture for simple multi-domain api gateway use case

0 votes

I am not familiar with GCP, however very familiar with AWS. The project in question had a requirement to be on GCP, so I need a little help.

Use case is simple, I need several domains (ie. domain1.com, domain2.com, *.domain3.com) to all point to and route ALL PATH REQUESTS to the same back end service, which is a cloud function.

As part of that flow, I need the original domain, and the path, passed to that cloud function (in the header or parameters) as I will be looking up information in firebase/firestore based on the domain and path, followed by performing an action.

I believe I have the first part setup correctly, but I am now stumped.

What I have done.

  1. Cloud function created, using node/express for reading the route and providing a response.
  2. api/gateway/config setup, with this config:
swagger: "2.0"
info:
  title: test api
  description: test api
  version: 1.0.0
schemes:
  - https
produces:
  - application/json
paths:
  /:
    get:
      summary: root request
      operationId: rootRequest
      x-google-backend:
        address: https://us-central1-project-name.cloudfunctions.net/cloudFunctionName
      responses:
        "200":
          description: A successful response
          schema:
            type: string
  /{code}:
    get:
      summary: path request
      operationId: pathRequest
      parameters:
        - name: code
          in: path
          description: actual code to look up
          required: true
          type: string
      x-google-backend:
        address:  https://us-central1-project-name.cloudfunctions.net/cloudFunctionName
        path_translation: APPEND_PATH_TO_ADDRESS
      responses:
        "200":
          description: A successful response
          schema:
            type: string
  1. Setup NEG for the API GATEWAY (ie gateway.dev domain)
  2. THIS IS WHERE I AM STUMPED. I'm setting up the load balancer, routing to a new backend service configured to the NEG in step 3. When at the frontend IP/port, I set to https, and the certificate requires domains, however, I am not able to add *.domain3.com because of the wildcard. This is hard requirement. Not sure where to go from here.

Questions:

  1. Is this setup directionally correct for achieving what I described at the top??

I need several domains (ie. domain1.com, domain2.com, *.domain3.com) to all point to and route ALL PATH REQUESTS to the same back-end service, which is a cloud function."

  1. Is there another way to allow a wildcard domain to the load balancer. I thought of perhaps setting up a Cloud CDN (not enabling CDN on the load balancer, but actually creating a unique CDN) and routing the origin to the load balancer, but haven't had a chance to test that.
Mar 31 in GCP by Rahul
• 3,380 points
182 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In GCP

0 votes
1 answer

Is there any API for GCP Pricing Calculator for https://cloud.google.com/compute/all-pricing?

You can take a look at the ...READ MORE

answered Mar 9 in GCP by Korak
• 5,820 points
580 views
0 votes
0 answers
0 votes
1 answer

What are the libraries and tools for cloud storage on GCP?

At the center level, XML API and ...READ MORE

answered Oct 7, 2019 in GCP by Sirajul
• 59,190 points
1,035 views
0 votes
1 answer
0 votes
1 answer

How to set up and use Pub/Sub Notifications for Cloud Storage?

The following steps add a notification configuration to your ...READ MORE

answered Nov 22, 2019 in GCP by Sirajul
• 59,190 points
1,307 views
0 votes
2 answers

Can we use domain based Email in Google Cloud IAM?

Hi@Lakshinarayanan, Yes, you can use. Sometimes we need when ...READ MORE

answered Jul 30, 2020 in GCP by MD
• 95,380 points
1,025 views
0 votes
1 answer
0 votes
0 answers

Dual Pricing for GCP Cloud Functions with Firebase

I created a new GCP Project, and ...READ MORE

Mar 14 in GCP by Rahul
• 3,380 points
61 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP