Skip to main content

service_bindings

Creates, updates, deletes, gets or lists a service_bindings resource.

Overview

Nameservice_bindings
TypeResource
Idcloudflare.addressing.service_bindings

Fields

The following fields are returned by SELECT queries:

The Service Binding with the requested ID

NameDatatypeDescription
idstringIdentifier of a Service Binding. (example: 0429b49b6a5155297b78e75a44b09e14)
service_idstringIdentifier of a Service on the Cloudflare network. Available services and their IDs may be found in the List Services endpoint. (example: 2db684ee7ca04e159946fd05b99e1bcd)
service_namestringName of a service running on the Cloudflare network (example: Magic Transit)
cidrstringIP Prefix in Classless Inter-Domain Routing format. (example: 192.0.2.0/24)
provisioningobjectStatus of a Service Binding's deployment to the Cloudflare network

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, prefix_id, binding_idFetch a single Service Binding
listselectaccount_id, prefix_idList the Cloudflare services this prefix is currently bound to. Traffic sent to an address within an IP prefix will be routed to the Cloudflare service of the most-specific Service Binding matching the address. Example: binding 192.0.2.0/24 to Cloudflare Magic Transit and 192.0.2.1/32 to the Cloudflare CDN would route traffic for 192.0.2.1 to the CDN, and traffic for all other IPs in the prefix to Cloudflare Magic Transit.
createinsertaccount_id, prefix_id, cidr, service_idCreates a new Service Binding, routing traffic to IPs within the given CIDR to a service running on Cloudflare's network. NOTE: The first Service Binding created for an IP Prefix must exactly match the IP Prefix's CIDR. Subsequent Service Bindings may be created with a more-specific CIDR. Refer to the Service Bindings Documentation for compatibility details.
deletedeleteaccount_id, prefix_id, binding_idDelete a Service Binding

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
binding_idstring
prefix_idstringThe IP prefix ID.

SELECT examples

Fetch a single Service Binding

SELECT
id,
service_id,
service_name,
cidr,
provisioning
FROM cloudflare.addressing.service_bindings
WHERE account_id = '{{ account_id }}' -- required
AND prefix_id = '{{ prefix_id }}' -- required
AND binding_id = '{{ binding_id }}' -- required
;

INSERT examples

Creates a new Service Binding, routing traffic to IPs within the given CIDR to a service running on Cloudflare's network. NOTE: The first Service Binding created for an IP Prefix must exactly match the IP Prefix's CIDR. Subsequent Service Bindings may be created with a more-specific CIDR. Refer to the Service Bindings Documentation for compatibility details.

INSERT INTO cloudflare.addressing.service_bindings (
cidr,
service_id,
account_id,
prefix_id
)
SELECT
'{{ cidr }}' /* required */,
'{{ service_id }}' /* required */,
'{{ account_id }}',
'{{ prefix_id }}'
RETURNING
errors,
messages,
result,
success
;

DELETE examples

Delete a Service Binding

DELETE FROM cloudflare.addressing.service_bindings
WHERE account_id = '{{ account_id }}' --required
AND prefix_id = '{{ prefix_id }}' --required
AND binding_id = '{{ binding_id }}' --required
;