Create a resource lock for a Linode

Beta Resource locks let you apply protection to an Akamai Cloud resource to help prevent you from inadvertently changing or deleting it. A lock can protect a specific resource (cannot_delete), or a resource and all of its assigned sub-resources (cannot_delete_with_subresources).

Here, we'll show you how to apply both forms of lock to a Linode.

Prerequisites

There are some tasks you need to complete before you can begin.

📘

Several of the operations here require that your user has unrestricted access on your account. Talk to your local account administrator about access management.

Get your Linode's id

To add a lock to a Linode you need its unique id value.

  1. Run the List Linodes operation.

  2. Locate the desired Linode from the response and store its id as your linodeId.

    {
      "data": [
        {
          "alerts": {
            "cpu": 180,
            "io": 10000,
            "network_in": 10,
            "network_out": 10,
            "transfer_quota": 80
          },
          "backups": {
            "available": true,
            "enabled": true,
            "last_successful": "2018-01-01T00:01:01",
            "schedule": {
              "day": "Saturday",
              "window": "W22"
            }
          },
          "capabilities": [
            "Block Storage Encryption"
          ],
          "created": "2018-01-01T00:01:01",
          "disk_encryption": "disabled",
          "has_user_data": true,
          "host_uuid": "1a2bcd34e5f67gh8ij901234567kl89mn01opqr2",
          "hypervisor": "kvm",
          "id": 87654, <== Store.
          ...
        }
      ],
      "page": 1,
      "pages": 1,
      "results": 1
    }
    

Create the lock

Follow these steps to add a resource lock to your Linode.

  1. Run the Create a resource lock operation. Include the following values in the request:

    • entity_id. Set this to your stored linodeId.

    • entity_type. Set this to linode, to set the lock for a Linode.

    • lock_type. Set this to your desired lock type:

      • cannot_delete. The Linode itself can't be deleted, and certain aspects of it can't be changed. Any sub-resources attached to it can be freely deleted.

      • cannot_delete_with_subresources. The Linode can't be deleted, and certain aspects of it can't be changed. In addition, various sub-resources that are assigned to it can't be deleted.

    {
      "entity_id": 8642531,
      "entity_type": "linode",
      "lock_type": "cannot_delete_with_subresources"
    }
    
  2. Review the response and store the id as your resourceLockId to interact with it later.

    {
      "entity": "linode",
      "id": "321", <== Store.
      "lock_type": "cannot_delete_with_subresources"
    }
    

What's blocked with each lock_type?

When you specify either resource lock_type for a Linode, you're blocked from performing specific tasks, including deleting the Linode and possibly its sub-resources.

Lock type setWhat's blocked

cannot_delete

cannot_delete_with_subresources

📘

A resource and its sub-resources may have additional requirements to delete. See the specific delete operation's documentation for details.

Unlock your Linode

With a resource lock applied, you need to delete it to "unlock" your Linode.

  1. If you didn't store your resourceLockId, you can run the List resource locks operation and review its response to get the lock's id.

    {
      "data": [
        {
          "entity": {
            "id": 321,
            "label": "Linode-video-streaming-assets-2025",
            "type": "linode",
            "url": "/v4/linode/instances/97531"
          },
          "id": 1,
          "lock_type": "cannot_delete_with_subresources"
        }
      ],
      "page": 1,
      "pages": 1,
      "results": 1
    }
    
  2. Run the Delete a resource lock operation, targeting your stored resourceLockId:

    curl --request DELETE \
      --url https://api.linode.com/v4beta/locks/321 \
    # Add Authorization header to this snippet
      --header 'accept: application/json'
    

With the resource lock deleted, you can now perform any of the tasks that are called out as blocked in What's blocked with each lock_type?.