Creating and using server entries with Dynamic Servers
Last updated April 25, 2018
Fastly's Load Balancer allows you to create pools of origin servers that you dynamically manage using Fastly's Dynamic Servers feature to distribute and direct incoming requests. An origin server is an address (IP address or hostname) of a server to which the Dynamic Servers feature can forward requests. Fastly can then select any one of the origin servers based on a selection policy defined for the pool.
IMPORTANT: This information is part of a limited availability release. For more information, see our product and feature lifecycle descriptions.
Creating an origin server
To add an origin server to the pool, make the following API call in a terminal application:
1
curl -vs -H "Fastly-Key: FASTLY_API_TOKEN" -X POST https://api.fastly.com/service/<service_id>/pool/<pool_id>/server -d 'address=<hostname_or_ip_address>'
The response will look like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"id": "6kEuoknxiaDBCLiAjKqyXq",
"service_id": "<service_id>",
"pool_id": "<pool_id>",
"weight": "100",
"max_conn": "200",
"port": "80",
"address": "<hostname_or_ip_address>",
"comment": "",
"disabled": false,
"created_at": "2016-06-20T08:20:36+00:00",
"updated_at": "2016-06-20T08:20:36+00:00",
"deleted_at": null
}
NOTE: Each Fastly service can be configured with up to five origin servers. Contact sales@fastly.com to enable more than five origin servers per service in your account.
Viewing origin servers
To see information related to a single origin server, make the following API call in a terminal application:
1
curl -vs -H "Fastly-Key: FASTLY_API_TOKEN" https://api.fastly.com/service/<service_id>/pool/<pool_id>/server/<hostname_or_ip_address>
The response will look like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"id": "6kEuoknxiaDBCLiAjKqyXq",
"service_id": "<service_id>",
"pool_id": "<pool_id>",
"weight": "100",
"max_conn": "200",
"port": "80",
"address": "<hostname_or_ip_address>",
"comment": "",
"disabled": false,
"created_at": "2016-06-20T08:20:36+00:00",
"updated_at": "2016-06-20T08:20:36+00:00",
"deleted_at": null
}
To view a list of all origin servers attached to a particular pool, make the following API call in a terminal application:
1
curl -vs -H "Fastly-Key: FASTLY_API_TOKEN" https://api.fastly.com/service/<service_id>/pool/<pool_id>/servers
The response will look like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[
{
"id": "6kEuoknxiaDBCLiAjKqyXq",
"service_id": "<service_id>",
"pool_id": "<pool_id>",
"weight": "100",
"max_conn": "200",
"port": "80",
"address": "<hostname_or_ip_address>",
"comment": "",
"disabled": false,
"created_at": "2016-06-20T08:20:36+00:00",
"updated_at": "2016-06-20T08:20:36+00:00",
"deleted_at": null
}
]
Enabling and disabling origin servers
You can enable or disable an origin server to control whether or not traffic is sent to it. Disabling an origin server allows you to remove it from the pool temporarily.
Enabling an origin server
Origin servers are enabled by default. To enable an origin server that has been disabled, make the following API call in a terminal application:
1
curl -vs -H "Fastly-Key: FASTLY_API_TOKEN" -X POST https://api.fastly.com/service/<service_id>/pool/<pool_id>/server -d 'address=<hostname_or_ip_address>&disabled=false'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"id": "6kEuoknxiaDBCLiAjKqyXq",
"service_id": "<service_id>",
"pool_id": "<pool_id>",
"weight": "100",
"max_conn": "200",
"port": "80",
"address": "<hostname_or_ip_address>",
"comment": "",
"disabled": false,
"created_at": "2016-06-20T08:20:36+00:00",
"updated_at": "2016-06-20T08:20:36+00:00",
"deleted_at": null
}
Disabling an origin server
To disable an origin server, make the following API call in a terminal application:
1
curl -vs -H "Fastly-Key: FASTLY_API_TOKEN" -X POST https://api.fastly.com/service/<service_id>/pool/<pool_id>/server -d 'address=<hostname_or_ip_address>&disabled=true'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"id": "6kEuoknxiaDBCLiAjKqyXq",
"service_id": "<service_id>",
"pool_id": "<pool_id>",
"weight": "100",
"max_conn": "200",
"port": "80",
"address": "<hostname_or_ip_address>",
"comment": "",
"disabled": true,
"created_at": "2016-06-20T08:20:36+00:00",
"updated_at": "2016-06-20T08:20:36+00:00",
"deleted_at": null
}
Deleting an origin server
To permanently delete an origin server, make the following API call in a terminal application:
1
curl -vs -H "Fastly-Key: FASTLY_API_TOKEN" -X DELETE https://api.fastly.com/service/<service_id>/pool/<pool_id>/server/<server_id>
The response will look like this:
1
2
3
{
"status":"ok"
}
NOTE: Pools must have at least one origin server. The API won't allow you to delete the last origin server in the pool.