Create Pool
Create a new pool.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Accepted Permissions (at least one required)
Parameters
A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.
Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).
The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.
The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.
The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.
The ID of the Monitor to use for checking the health of origins within this pool.
The ID of the Monitor Group to use for checking the health of origins within this pool.
This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.
Create Pool
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
pool = client.load_balancers.pools.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
name="primary-dc-1",
origins=[{}],
)
print(pool.id){
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "17b5962d775c646f3f9725cbc7a53df4",
"check_regions": [
"WEU",
"ENAM"
],
"created_on": "2014-01-01T05:20:00.12345Z",
"description": "Primary data center - Provider XYZ",
"disabled_at": "2019-12-27T18:11:19.117Z",
"enabled": false,
"latitude": 0,
"load_shedding": {
"default_percent": 0,
"default_policy": "random",
"session_percent": 0,
"session_policy": "hash"
},
"longitude": 0,
"minimum_origins": 0,
"modified_on": "2014-01-01T05:20:00.12345Z",
"monitor": "monitor",
"monitor_group": "monitor_group",
"name": "primary-dc-1",
"networks": [
"string"
],
"notification_email": "someone@example.com,sometwo@example.com",
"notification_filter": {
"origin": {
"disable": true,
"healthy": true
},
"pool": {
"disable": true,
"healthy": false
}
},
"origin_steering": {
"policy": "random"
},
"origins": [
{
"address": "0.0.0.0",
"disabled_at": "2019-12-27T18:11:19.117Z",
"enabled": true,
"header": {
"Host": [
"example.com"
]
},
"name": "app-server-1",
"port": 0,
"virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4",
"weight": 0.6
}
]
},
"success": true
}Returns Examples
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"id": "17b5962d775c646f3f9725cbc7a53df4",
"check_regions": [
"WEU",
"ENAM"
],
"created_on": "2014-01-01T05:20:00.12345Z",
"description": "Primary data center - Provider XYZ",
"disabled_at": "2019-12-27T18:11:19.117Z",
"enabled": false,
"latitude": 0,
"load_shedding": {
"default_percent": 0,
"default_policy": "random",
"session_percent": 0,
"session_policy": "hash"
},
"longitude": 0,
"minimum_origins": 0,
"modified_on": "2014-01-01T05:20:00.12345Z",
"monitor": "monitor",
"monitor_group": "monitor_group",
"name": "primary-dc-1",
"networks": [
"string"
],
"notification_email": "someone@example.com,sometwo@example.com",
"notification_filter": {
"origin": {
"disable": true,
"healthy": true
},
"pool": {
"disable": true,
"healthy": false
}
},
"origin_steering": {
"policy": "random"
},
"origins": [
{
"address": "0.0.0.0",
"disabled_at": "2019-12-27T18:11:19.117Z",
"enabled": true,
"header": {
"Host": [
"example.com"
]
},
"name": "app-server-1",
"port": 0,
"virtual_network_id": "a5624d4e-044a-4ff0-b3e1-e2465353d4b4",
"weight": 0.6
}
]
},
"success": true
}