Skip to main content

Suspend a CDN resource automatically or manually

CDN resources can be suspended automatically by the system after 90 days of inactivity, or manually at any time from the resource settings.

Automatic CDN resource suspension

If a resource is active, but there has not been traffic in 90 days, it will be automatically suspended by the system.

All users with administrator and engineer roles will receive an email seven days before resource suspension, listing the resources scheduled for suspension.

The resource settings display the scheduled suspension date and time:

Resource settings showing the scheduled automatic suspension date and time

After the resource suspension, all users with the administrator and engineer roles will receive an email with a list of stopped resources.

If traffic resumes on the resource after receiving the first email:

  • The second email about the suspension will not be sent.
  • The resource will not be suspended.

After re-enabling an automatically suspended resource, a notice appears explaining that it was suspended due to 90 days without traffic. Re-enabling a resource that was automatically suspended starts a seven-day grace period instead of a new 90-day inactivity period. If traffic does not resume during those seven days, the resource is suspended again.

To disable automatic suspension for specific resources, contact CDB Support.

Manual CDN resource suspension

In the CDB Technical Web Portal, navigate to CDN > CDN resources. Click the resource name to open its settings.

Disable the Content availability toggle.

CDN resource settings showing the Content availability toggle in the enabled state

Then select Yes, suspend.

Confirmation dialog for suspending a CDN resource

The Content availability toggle changes to the disabled state.

CDN resource settings showing the Content availability toggle in the disabled state

Click Save changes. The resource stops delivering content after the changes propagate, which takes about 15 minutes.

CDN resource settings with the Save changes button

Suspend a CDN resource so it stops delivering content, or enable it again. A resource with no traffic for 90 days is suspended by the system. That automatic stop is not started by this call.

An API token is required. The CDN resource ID is visible under CDN → CDN Resources, or from the resources list call.

The API response reflects the configuration change immediately, while delivery on the edge can take about 15 minutes to catch up. Automatic inactivity suspension is managed by the system and cannot be disabled through this call. To exclude specific resources from automatic suspension, contact CDB Support.

Open a terminal and export the required variables:

export GCORE_API_KEY="{YOUR_API_KEY}"
export CDN_RESOURCE_ID="{YOUR_CDN_RESOURCE_ID}"

Suspend the resource

Set active to false. Do not confuse status with suspended. status describes whether the resource is currently delivering content. suspended indicates whether the system automatically stopped it because of inactivity. A manual suspend sets status to suspended and leaves suspended as false. suspend_date is read-only and is null for a manual suspend. If the resource was already stopped by the system, suspended stays true until it is enabled.

import os

from gcore import CDB

client = CDB()
resource_id = int(os.environ["CDN_RESOURCE_ID"])

updated = client.cdn.cdn_resources.update(resource_id, active=False)
print(updated.active, updated.status, updated.suspended)
package main

import (
    "context"
    "fmt"
    "os"
    "strconv"

    gcore "github.com/G-Core/gcore-go"
    "github.com/G-Core/gcore-go/cdn"
)

func main() {
    client := gcore.NewClient()
    ctx := context.Background()
    resourceID, err := strconv.ParseInt(os.Getenv("CDN_RESOURCE_ID"), 10, 64)
    if err != nil {
        panic(err)
    }

    updated, err := client.CDN.CDNResources.Update(ctx, resourceID, cdn.CDNResourceUpdateParams{
        Active: gcore.Bool(false),
    })
    if err != nil {
        panic(err)
    }
    fmt.Println(updated.Active, updated.Status, updated.Suspended)
}
curl -X PATCH "https://api.cdb-staging.cdn.orange.com/cdn/resources/$CDN_RESOURCE_ID" \
  -H "Authorization: APIKey $GCORE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"active": false}'

The API returns HTTP 200. A manual suspend looks like this:

{
  "id": 101,
  "active": false,
  "status": "suspended",
  "suspended": false,
  "suspend_date": null
}

Enable the resource

Set active to true. status becomes active and suspended becomes false, including when the resource had been stopped for lack of traffic. Re-enabling a resource that was automatically suspended starts a seven-day grace period instead of a new 90-day inactivity period. If traffic does not resume during those seven days, the resource is suspended again.

import os

from gcore import CDB

client = CDB()
resource_id = int(os.environ["CDN_RESOURCE_ID"])

updated = client.cdn.cdn_resources.update(resource_id, active=True)
print(updated.active, updated.status, updated.suspended)
package main

import (
    "context"
    "fmt"
    "os"
    "strconv"

    gcore "github.com/G-Core/gcore-go"
    "github.com/G-Core/gcore-go/cdn"
)

func main() {
    client := gcore.NewClient()
    ctx := context.Background()
    resourceID, err := strconv.ParseInt(os.Getenv("CDN_RESOURCE_ID"), 10, 64)
    if err != nil {
        panic(err)
    }

    updated, err := client.CDN.CDNResources.Update(ctx, resourceID, cdn.CDNResourceUpdateParams{
        Active: gcore.Bool(true),
    })
    if err != nil {
        panic(err)
    }
    fmt.Println(updated.Active, updated.Status, updated.Suspended)
}
curl -X PATCH "https://api.cdb-staging.cdn.orange.com/cdn/resources/$CDN_RESOURCE_ID" \
  -H "Authorization: APIKey $GCORE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"active": true}'

The API returns HTTP 200:

{
  "id": 101,
  "active": true,
  "status": "active",
  "suspended": false,
  "suspend_date": null
}

Suspend or enable a CDN resource with the Terraform provider v2.

A resource with no traffic for 90 days is suspended by the system. Setting active suspends or enables the resource manually. To exclude specific resources from automatic suspension, contact CDB Support.

Suspend the resource

Set active to false and run terraform apply. The update is in place, while suspended stays false and suspend_date stays empty, because those attributes record an automatic stop. The configuration changes immediately, while delivery on the edge can take about 15 minutes.

resource "gcore_cdn_origin_group" "example" {
  name = "my-origin-group"

  sources = [
    {
      source  = "example.com"
      enabled = true
    }
  ]
}

resource "gcore_cdn_resource" "example" {
  cname           = "hold.example.com"
  origin_group    = gcore_cdn_origin_group.example.id
  origin_protocol = "HTTPS"
  active          = false
}

Enable the resource

Set active to true and run terraform apply. After the resource is enabled, suspended is false, including when the system had stopped it for inactivity. Re-enabling that resource starts a seven-day grace period. If traffic does not resume during those seven days, the resource is suspended again.

resource "gcore_cdn_origin_group" "example" {
  name = "my-origin-group"

  sources = [
    {
      source  = "example.com"
      enabled = true
    }
  ]
}

resource "gcore_cdn_resource" "example" {
  cname           = "hold.example.com"
  origin_group    = gcore_cdn_origin_group.example.id
  origin_protocol = "HTTPS"
  active          = true
}

Delete the CDN resource

Remove the resource blocks. The next terraform apply deletes the CDN resource, then the origin group.

# Remove the CDN resource and the origin group:
# resource "gcore_cdn_origin_group" "example" {
#   name = "my-origin-group"
#
#   sources = [
#     {
#       source  = "example.com"
#       enabled = true
#     }
#   ]
# }
#
# resource "gcore_cdn_resource" "example" {
#   cname           = "hold.example.com"
#   origin_group    = gcore_cdn_origin_group.example.id
#   origin_protocol = "HTTPS"
#   active          = false
# }
terraform apply