Skip to content
  • Products
    • Portfolio overview >

      Flexsave™

      Automatically manage cloud compute for optimized costs and agility

      Cloud Analytics

      Make sense of spend and chargeback to align with your business

      google cloud msp

      BigQuery Lens

      Optimize BigQuery costs with actionable recommendations and usage insights

      Spot Scaling

      Maximize AWS Spot savings and minimize disruptions for optimized scaling

      Anomaly Detection

      Autonomously identify cost spikes early, with zero configuration

      Platform overview >

      Organize your billing data for better business decisions

  • Services
    • Services overview >

      How we work

      Learn how we’re redefining support with our customer reliability engineering

      Stats

      View our live support and customer satisfaction statistics in real-time

      Cloud solutions

      Proven solutions to cloud complexity

      FinOps

      Learn how DoiT enables critical FinOps capabilities

      Areas of expertise

      Cloud Architecture

      Ensure your cloud architecture is future-ready and built for success

      Cloud Cost Optimization

      Identify opportunities to optimize costs and target spend for added value

      Cloud Migration

      Realize greater efficiency and innovation with successful cloud migration

      Cloud Security

      Center security in your cloud strategy to ensure ongoing efficacy and growth

      Data and Analytics

      Harness the potential of big data and analytics to gain a competitive edge

      Data Management

      Build your data practice with expert guidance tailored to your business goals

      DevOps Jump Start

      Accelerate your AWS workloads & release pipelines while also increasing automation, monitoring & reliability

      Infrastructure

      Maximize the full suite capabilities from your cloud infrastructure

      Kubernetes

      Manage the complexity of Kubernetes to enable innovation and scalability

      Location-Based Services

      Transform geolocational data into real-world, real-time intelligence

      Machine Learning

      Level-up key data with ML capabilities that accelerate innovation

      Multicloud

      Create meaningful business value with a robust multicloud strategy

      Training

      Build skills and capability across teams with certified, expert-led training

  • Partners
    • Alliances

      Proud to be an award‒winning multicloud partner to top‒tier cloud providers

      doit-together

      DoiT Together

      Enabling cloud growth and unlocking revenue through expert partnership

      ISV Go-Global

      Accelerate new customer growth and Marketplace integration on AWS and GCP

  • Resources
    • Resources hub >

      Blog

      Read the latest insights, tips and perspectives from our team of cloud experts

      Case Studies

      See how we’ve helped thousands of public cloud customers achieve their goals

      Cloud Masters Podcast

      Listen to our experts and customers share tangible tips for navigating the cloud.

      Ebooks and Guides

      Discover foundational expertise and future-ready recommendations for the cloud

      Events and Webinars

      Tech talks and interactive expert sessions delivered both virtually and in person

      GCPInstances.info

      Google Cloud Compute Engine instance comparison

      Help center

      Read documentation, product updates, and more

      Newsroom

      See what's new from DoiT in our latest news and announcements

      Trust Center

      How we focus on security, compliance, and privacy

      Videos

      Watch product demos, interviews and more from our cloud experts

  • About
    • About DoiT >

      Careers

      Browse our open positions and learn more about what it takes to be a Do’er

      Leadership

      Meet the team leading DoiT and our customers on a journey of hypergrowth

      Newsroom

      See what's new from DoiT in our latest news and announcements

  • Pricing
  • Contact us
  • Sign In
  • Products
    • Flexsave ™
    • Cloud Analytics
    • Spot Scaling
    • BigQuery Lens
    • Anomaly Detection
    • DoiT Platform
  • Services
    • How We Work
    • Stats
    • Cloud Solutions
    • FinOps
    • Areas of expertise
      • Cloud Architecture
      • Cloud Cost Optimization
      • Cloud Migration Consulting Services
      • Cloud Security
      • Data and Analytics
      • Data Management
      • DevOps with AWS & DoiT
      • Infrastructure
      • Kubernetes
      • Location Based Services
      • Machine Learning
      • Multicloud
      • Training
  • Partners
    • ISV Go-Global
    • Award-winning public cloud partner
    • DoiT Together
  • Resources
    • Blog
    • Case Studies
    • Cloud Masters Podcast
    • Ebooks and Guides
    • Events and Webinars
    • GCPInstances.info
    • Help center
    • Newsroom
    • Trust Center
    • Videos
  • Pricing
  • About
    • Careers
    • Leadership
    • Newsroom
  • Contact us
  • Sign In
Contact us
Sign in

Blog

Domain authorization: The faster way to provision managed certificates in GCP

  • Chimbu Chinnadurai Chimbu Chinnadurai
  • Date: July 28, 2023
Domain authorization- The faster way to provision managed certificates in GCP DoiT

In today’s digital landscape, ensuring the security and privacy of online communication is of utmost importance. SSL certificates play a critical role in establishing secure connections, protecting sensitive data, and fostering trust between users and websites.

When setting up SSL certificates in Google Cloud Platform (GCP) for load balancers, the verification of domain ownership is a key factor. Traditionally, load balancer-based authorization has been the preferred method. It involves mounting a Google-Managed SSL certificate on a load balancer and associating the domain to the load balancer’s IP using an A record.

Setting up managed SSL certificates through load balancer-based authorization can be time-consuming and error-prone. First, users must complete all configuration steps before provisioning the TLS (SSL) certificate. This can lead to delays if users make mistakes or forget to complete a step. Second, global DNS record propagation can take up to 48 hours. This means that there is a typical window of 10–15 minutes where the SSL certificate’s domain is inaccessible. As a result, this approach is most suitable for setting up new environments without production traffic.

To overcome these challenges and ensure that Google-managed certificates are ready ahead of load balancer or migration to Google Cloud from another vendor, Domain authorization offers an alternative solution. With Domain authorization, additional dedicated DNS records are configured to verify domain ownership. This enables the provisioning of certificates in advance, even before the target proxy is fully prepared to handle network traffic. As a result, zero-downtime migrations from third-party solutions to Google Cloud become feasible, providing a smoother transition process.

Refer to the below table for differences between Load balancer authorization and Domain authorization.

“domain-authorization-doit”

This article will show you how to set up domain authorization and create new certificates in the certificate manager using domain authorization.

Prerequisites

  • A public DNS zone in Cloud DNS

Domain authorization also works with other DNS providers and the .

  • Certificate manager API enabled in the GCP project.
  • gcloud CLI.

For this article, I am using the Public zone  chimbuc.dns.doit-playground.com in Cloud DNS.

“domain-authorization-gcp”

Set up DNS authorization

  • Set up the necessary env variables.
export PROJECT_ID="your-project-id"
export REGION="your-region" # ex: us-central1
export DOMAIN_NAME="domain-name-for-the-certificate" # ex: example.chimbuc.dns.doit-playground.com
export DOMAIN_AUTHORIZATION_NAME="dns-authorization-resource-name" # ex: dns-authorization-example
export CLOUD_DNS_ZONE_NAME="your-cloud-dns-zone" # ex: chimbuc.dns.doit-playground.com.
export CERTIFICATE_NAME="certificate-manager-cert-name" # ex: example-chimbuc-dns-doit-playground-com
export CERTIFICATE_MAP_NAME="certificate-map-name" # ex: example-dns-authorization-cert-map
export CERTIFICATE_MAP_ENTRY_NAME="certificate-map-entry" # ex: example-dns-authorization-cert-map-entry
  • Create a DNS authorization for your domain. Because each DNS authorization covers only a single hostname, you must create a DNS authorization for each hostname you want to use with the target certificate.

If you’re creating DNS authorization for a wildcard certificate, such as  *.example.com , configure the DNS authorization for the parent domain (such as  example.com ).

gcloud certificate-manager dns-authorizations create $DOMAIN_AUTHORIZATION_NAME \
     --domain="${DOMAIN_NAME}" \
     --project $PROJECT_ID

“provision-certificates”

DNS authorization for example.chimbuc.dns.doit-playground.com

  • Get the CNAME record details which you must add to your DNS configuration.
gcloud certificate-manager dns-authorizations describe $DOMAIN_AUTHORIZATION_NAME \
    --project $PROJECT_ID

“provision

DNS authorization details for example.chimbuc.dns.doit-playground.com

  • Add the CNAME record to your DNS configuration. If you’re using Google Cloud to manage your DNS, complete the steps in this section. Otherwise, consult the documentation for your third-party DNS solution.
#Initiate the DNS record transaction
gcloud dns record-sets transaction start --zone="${CLOUD_DNS_ZONE_NAME}" \
  --project $PROJECT_ID

#Add the CNAME record to the target DNS zone
gcloud dns record-sets transaction add CNAME_RECORD_DATA \
  --name="_acme-challenge.${DOMAIN_NAME}." \
  --ttl="30" \
  --type="CNAME" \
  --zone="${CLOUD_DNS_ZONE_NAME}" \
  --project $PROJECT_ID

#Execute the DNS record transaction to save your changes
gcloud dns record-sets transaction execute --zone="${CLOUD_DNS_ZONE_NAME}" \
  --project $PROJECT_ID

“managed-certificates”

DNS configuration

Create a Google-managed certificate with DNS authorization

  • Create the certificate for the domain that is configured with DNS authorization. You can only create Google-managed certificates in the global location.
gcloud certificate-manager certificates create $CERTIFICATE_NAME \
  --domains="${DOMAIN_NAME}" \
  --dns-authorizations="${DOMAIN_AUTHORIZATION_NAME}" \
  --project $PROJECT_ID

“gcp-managed-certificates”

“managed

Allow a few minutes for the certificate to be provisioned. Once it is complete, the status will change to active. If the status is Pending for an extended period, then Click the certificate name to view the failure reasons.

  • Verify the certificate status.
gcloud certificate-manager certificates describe $CERTIFICATE_NAME --project $PROJECT_ID

“google-managed-certificate”

To deploy the generated certificate to a load balancer, we must create a certificate map that references one or more certificate map entries that assign specific certificates to specific hostnames. Refer to How Certificate Manager Works for more details.

  • Create a certificate map.
gcloud certificate-manager maps create $CERTIFICATE_MAP_NAME --project $PROJECT_ID

“gcloud-compute-instance-groups-managed-create”

Certificate Map

  • Create a certificate map entry for the domain.
gcloud certificate-manager maps entries create $CERTIFICATE_MAP_ENTRY_NAME \
  --map="${CERTIFICATE_MAP_NAME}" \
  --certificates="${CERTIFICATE_NAME}" \
  --hostname="${DOMAIN_NAME}" \
  --project $PROJECT_ID

“gcp-load-balancer”

Certificate Map entry

Allow a few minutes for the certificate map entry to be provisioned, and the status is changed to active.

gcloud certificate-manager maps entries describe $CERTIFICATE_MAP_ENTRY_NAME \
  --map="${CERTIFICATE_MAP_NAME}" \
  --project $PROJECT_ID

“create-https-proxy”

Deploy a sample application

  • Create a managed instance group and install Apache.
#Create an instance template.
gcloud compute instance-templates create web-app-instance-template \
  --region=$REGION \
  --project $PROJECT_ID \
  --network=default \
  --subnet=default \
  --tags=allow-health-check \
  --image-family=debian-10 \
  --image-project=debian-cloud \
  --metadata=startup-script='#! /bin/bash
     apt-get update
     apt-get install apache2 -y
     a2ensite default-ssl
     a2enmod ssl
     vm_hostname="$(curl -H "Metadata-Flavor:Google" \
   http://metadata.google.internal/computeMetadata/v1/instance/name)"
   echo "Page served from: $vm_hostname" | \
   tee /var/www/html/index.html
   systemctl restart apache2'

#Create the managed instance group based on the template.

gcloud compute instance-groups managed create web-app-instance-group \
  --template=web-app-instance-template \
  --size=1 \
  --zone="${REGION}"-b \
  --project $PROJECT_ID

#Add a named port to the instance group

gcloud compute instance-groups set-named-ports web-app-instance-group \
  --named-ports http:80 \
  --zone "${REGION}"-b \
  --project $PROJECT_ID
  • Create a firewall rule to allow traffic from the Google Cloud health checking systems.
gcloud compute firewall-rules create fw-allow-health-check \
  --network=default \
  --action=allow \
  --direction=ingress \
  --source-ranges=130.211.0.0/22,35.191.0.0/16 \
  --target-tags=allow-health-check \
  --rules=tcp:80 \
  --project $PROJECT_ID

“certificate-map”

sample instance

Deploy the certificate to a load balancer

  • Create the load balancer resources.
#Reserve an external ip
gcloud compute addresses create external-lb-ipv4 \
  --ip-version=IPV4 \
  --network-tier=PREMIUM \
  --global \
  --project $PROJECT_ID

#Create a health check
gcloud compute health-checks create http http-basic-check \
  --port 80 \
  --project $PROJECT_ID

#Create a backend service
gcloud compute backend-services create web-app-backend-service \
  --load-balancing-scheme=EXTERNAL \
  --protocol=HTTP \
  --port-name=http \
  --health-checks=http-basic-check \
  --global \
  --project $PROJECT_ID

#Add the instance group as the backend to the backend service.
gcloud compute backend-services add-backend web-app-backend-service \
  --instance-group=web-app-instance-group \
  --instance-group-zone="${REGION}"-b \
  --global \
  --project $PROJECT_ID

#create a URL map to route the incoming requests to the default backend service
gcloud compute url-maps create web-app-url-map-https \
  --default-service web-app-backend-service \
  --project $PROJECT_ID
  • Create a target HTTPS proxy to route requests to the URL map and attach the certificate map to the target proxy.
gcloud compute target-https-proxies create https-lb-proxy \
  --url-map=web-app-url-map-https \
  --certificate-map="${CERTIFICATE_MAP_NAME}" \
  --project $PROJECT_ID

“gcp-tls”

The certificate is attached to the target HTTPS proxy

  • Create a global forwarding rule to route incoming requests to the proxy.
gcloud compute forwarding-rules create web-app-https-fw-rule \
  --load-balancing-scheme=EXTERNAL \
  --network-tier=PREMIUM \
  --address=external-lb-ipv4 \
  --global \
  --target-https-proxy=https-lb-proxy \
  --ports=443 \
  --project $PROJECT_ID

“gcp-security”

External LB configuration

  • Create a record set in cloud DNS for the domain and access the endpoint.

“setting-up-ssl-certificates-in-google-cloud-platform”

A record for example.chimbuc.dns.doit-playground.com

“setting-up-managed-ssl-certificates-through-load-balancer-based-authorization”

Conclusion

In conclusion, leveraging domain authorization in Google Cloud Platform (GCP) provides a significant speed improvement for SSL certificate provisioning compared to the traditional load balancer-based authorization method. By following the detailed steps outlined in this blog, you can efficiently set up domain authorization, create new TLS certificates, and strengthen the security of your GCP environment. This approach minimizes downtime and ensures a smoother transition.

Subscribe to updates, news and more.

Subscribe

Subscribe to updates, news and more.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related blogs

Using predefined IAM roles for enhanced Google Maps Platform governance

Examining using predefined Google Cloud IAM roles dedicated to Google Maps usage to enhance the governance of these activities.

Keep reading 
Ramp Plans Resource Hub Header1

Monitor your cloud commit attainment with DoiT Ramp Plans

DoiT Ramp Plans help you visualize, manage, and track your commit attainment so you can make sure you spend what you committed to, and act proactively.

Keep reading 
DoiT-Google-Kubernetes-Engine-Troubleshooting-Made-Simple-with-Interactive-Playbooks

Google Kubernetes Engine Troubleshooting Made Simple with Interactive Playbooks

In modern application management, Kubernetes is the foundation of container orchestration. It automates software deployment, scaling, and management, revolutionising delivery. However, growing complexity and scale pose challenges in troubleshooting and maintaining dynamic ecosystems.

Keep reading 
View all blogs
Let’s do it

From cost optimization to cloud migration, machine learning and CloudOps, we’re here to make the public cloud easy — without the costs.

Ready to get started?

Get in touch

Company

  • About us
  • Blog
  • Careers
  • MS-HT statement
  • Newsroom
  • Privacy policy
  • Terms

Offering

  • Compliance
  • Products
  • Services
  • Solutions
  • Resources

Support

  • Sign in
  • Help center
  • Open ticket
  • Contact us

Never miss an update.

Subscribe to our newsletter

Subscribe to updates, news and more.