This tutorial shows you how to migrate third-party certificates to a Google Cloud load balancer using Certificate Manager.
To migrate third-party certificates with no downtime, create the same number of Google-managed certificates as your third-party certificates. Next, consolidate the certificates into a single certificate map, and deploy the certificate map to a load balancer using DNS. Finally, update the DNS A and AAAA records to point to the load balancer's IP address.
To find the list of supported load balancers, see Certificate Manager overview.
Objectives
This tutorial shows you how to complete the following tasks:
- Create Google-managed certificates with DNS authorization.
- Create one certificate map for all certificates.
- Deploy certificates to your load balancer using DNS.
- Update the DNS A and AAAA records to point to the load balancer's IP address.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Compute Engine, Certificate Manager APIs.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init -
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Compute Engine, Certificate Manager APIs.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
Required roles
Make sure that you have the following roles to complete the tasks in this tutorial:
Certificate Manager Owner (
roles/certificatemanager.owner)Required to create and manage Certificate Manager resources.
Compute Load Balancer Admin (
roles/compute.loadBalancerAdmin) or Compute Network Admin (roles/compute.networkAdmin)Required to create and manage HTTPS target proxy.
DNS Administrator (
roles/dns.admin)Required if you want to use Cloud DNS as your DNS solution.
For more information, see the following:
- Roles and permissions for Certificate Manager.
- Compute Engine IAM roles and permissions for Compute Engine.
- Roles and permissions for Cloud DNS.
Create Google-managed certificates
Create the same number of Google-managed certificates with DNS authorization (recommended) or self-managed certificates as third-party certificates. Before you create the certificates, create a DNS authorization and add the CNAME record to the authoritative DNS zone for your domain.
This section lists steps and commands to create global Google-managed certificates. To create regional or cross-region Google-managed certificates, see Create a Google-managed certificate.
Create a DNS authorization
A DNS authorization only covers a single domain name. You must create a separate DNS authorization for each domain name that you want to use with the target certificate.
If you're creating a
DNS authorization for a wildcard certificate, such as *.myorg.example.com,
configure the DNS authorization for the parent domain—for example,
myorg.example.com.
Console
You can create a DNS authorization or attach an existing DNS authorization when creating a certificate. For more information, see Create a Google-managed certificate referencing the DNS authorization.
gcloud
You can create two types of DNS
authorizations: FIXED_RECORD or PER_PROJECT_RECORD. For more
information, see DNS authorization.
FIXED_RECORD DNS authorization
To create a FIXED_RECORD DNS authorization, use the following gcloud certificate-manager dns-authorizations create command:
gcloud certificate-manager dns-authorizations create AUTHORIZATION_NAME \
--domain="DOMAIN_NAME" \
--type=[FIXED_RECORD]
Replace the following:
AUTHORIZATION_NAME: the name of the DNS authorization.DOMAIN_NAME: the name of the target domain for which you are creating this DNS authorization. The domain name must be a fully qualified domain name, such asmyorg.example.com.
After creating the FIXED_RECORD DNS authorization, verify it with the
gcloud certificate-manager dns-authorizations describe command:
gcloud certificate-manager dns-authorizations describe AUTHORIZATION_NAME
The output is similar to the following. In the output, find the
dnsResourceRecord section. Locate the CNAME record and add the record's
details (data,name, and type) to your DNS configuration.
createTime: '2022-01-14T13:35:00.258409106Z' dnsResourceRecord: data: 0e40fc77-a37d-4eb8-8fe1-eea2e18d12d9.4.authorize.certificatemanager.goog. name: _acme-challenge.myorg.example.com. type: CNAME domain: myorg.example.com name: projects/myProject/locations/global/dnsAuthorizations/myAuthorization updateTime: '2022-01-14T13:35:01.571086137Z'
PER_PROJECT_RECORD DNS authorization
To create a PER_PROJECT_RECORD DNS authorization, use the following
gcloud certificate-manager dns-authorizations create command:
gcloud certificate-manager dns-authorizations create AUTHORIZATION_NAME \
--domain="DOMAIN_NAME" \
--type=PER_PROJECT_RECORD
Replace the following:
AUTHORIZATION_NAME: the name of the DNS authorization.DOMAIN_NAME: the name of the target domain for which you are creating this DNS authorization. The domain name must be a fully qualified domain name, such asmyorg.example.com.
After creating the PER_PROJECT_RECORD DNS authorization, verify it with
the gcloud certificate-manager dns-authorizations describe command:
gcloud certificate-manager dns-authorizations describe AUTHORIZATION_NAME
The output is similar to the following. In the output, find the
dnsResourceRecord section. Locate the CNAME record and add the record's
details (data,name, and type) to your DNS configuration.
createTime: '2022-01-14T13:35:00.258409106Z' dnsResourceRecord: data: 0e40fc77-a37d-4eb8-8fe1-eea2e18d12d9.4.authorize.certificatemanager.goog. name: _acme-challenge_ujmmovf2vn55tgye.myorg.example.com type: CNAME domain: myorg.example.com name: projects/myProject/locations/global/dnsAuthorizations/myAuthorization updateTime: '2022-01-14T13:35:01.571086137Z'
Terraform
To create a DNS authorization, you can use a
google_certificate_manager_dns_authorization resource.
To learn how to apply or remove a Terraform configuration, see Basic Terraform commands.
API
To create a DNS authorization, make a POST request to the dnsAuthorizations.create method:
POST /v1/projects/PROJECT_ID/locations/global/dnsAuthorizations?dns_authorization_id=AUTHORIZATION_NAME
{
"domain": "DOMAIN_NAME",
"type": "PER_PROJECT_RECORD" //optional
}
Replace the following:
PROJECT_ID: ID of your Google Cloud project.AUTHORIZATION_NAME: the name of the DNS authorization.DOMAIN_NAME: the name of the target domain for which you are creating this DNS authorization. The domain name must be a fully qualified domain name, such asmyorg.example.com.
Create a Google-managed certificate referencing the DNS authorization
To create a global Google-managed certificate that references the DNS authorization you created in the previous steps, do the following:
Console
In the Google Cloud console, go to the Certificate Manager page.
On the Certificates tab, click Add Certificate.
In the Certificate name field, enter a unique name for the certificate.
Optional: In the Description field, enter a description for the certificate. The description lets you identify the certificate.
For Location, select Global.
For Scope, select Default.
For Certificate type, select Create Google-managed certificate.
For Certificate Authority type, select Public.
In the Domain Names field, specify a comma-separated list of domain names of the certificate. Each domain name must be a fully qualified domain name, such as
myorg.example.com. The domain name can also be a wildcard domain name, such as*.example.com.