Skip to main content

Triage and Remediation

Remediation

Using Console

Sure, here are the step-by-step instructions to remediate the misconfiguration of Cloud CDN Regional Backend Services not having Connection Draining in GCP using the GCP console:
  1. Open the GCP Console and log in to your account.
  2. Navigate to the Cloud CDN page by selecting the “Navigation menu > Network Services > Cloud CDN”.
  3. From the Cloud CDN page, select the name of the CDN that you want to configure the connection draining for.
  4. In the CDN details page, select the “Backend Configuration” tab.
  5. In the Backend Configuration page, select the “Edit” button located at the top of the page.
  6. In the “Edit Backend Configuration” page, scroll down to the “Backend Service” section and select the name of the backend service that you want to configure connection draining for.
  7. In the “Backend Service” page, select the “Edit” button located at the top of the page.
  8. Scroll down to the “Connection Draining” section and select the “Enable” checkbox.
  9. In the “Connection Draining Timeout” field, specify the amount of time (in seconds) that you want to wait for the existing connections to complete before shutting down the backend service. The recommended value is 300 seconds.
  10. Select the “Save” button to save the changes.
After following these steps, the connection draining feature will be enabled for the selected backend service in your GCP Cloud CDN.

To remediate the misconfiguration of Cloud CDN Regional Backend Services not having connection draining on GCP using GCP CLI, follow the below steps:
  1. Open the Google Cloud Console and go to the Cloud Shell.
  2. Run the following command to list all the backend services in your project:
  1. Choose the backend service that you want to update and run the following command to describe the backend service:
  1. Check if the connection draining configuration is set for the backend service. If not, add the connection draining configuration by running the following command:
Replace [BACKEND_SERVICE_NAME] with the name of the backend service you want to update, [REGION] with the region where the backend service is located, and [TIMEOUT_SECONDS] with the number of seconds that you want to set for the connection draining timeout.For example, to set the connection draining timeout to 60 seconds for a backend service named “my-backend-service” located in the “us-central1” region, run the following command:
  1. Verify that the connection draining configuration is set for the backend service by running the following command:
Make sure that the “connectionDraining” field shows the correct value for the connection draining configuration.By following these steps, you can remediate the misconfiguration of Cloud CDN Regional Backend Services not having connection draining on GCP using GCP CLI.
To remediate the misconfiguration of Cloud CDN Regional Backend Services not having connection draining in GCP using Python, you can follow the below steps:
  1. Install the necessary Python libraries:
  1. Set up authentication:
  1. Retrieve the list of backend services:
  1. For each backend service, check if connection draining is enabled:
  1. If connection draining is not enabled, update the backend service to enable it:
By following these steps, you can remediate the misconfiguration of Cloud CDN Regional Backend Services not having connection draining in GCP using Python.
Changing only connection_draining.draining_timeout_sec is an in-place update on google_compute_region_backend_service and does not force replacement.To verify, terraform plan should show an in-place update (~) on google_compute_region_backend_service.CDN_BACKEND_SERVICE adding or modifying the connection_draining block with draining_timeout_sec = DRAINING_TIMEOUT_SECONDS.