Creating and using server entries with Dynamic Servers

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 additional details, read 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:

$ 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 "id": "6kEuoknxiaDBCLiAjKqyXq",
3 "service_id": "<service_id>",
4 "pool_id": "<pool_id>",
5 "weight": "100",
6 "max_conn": "200",
7 "port": "80",
8 "address": "<hostname_or_ip_address>",
9 "comment": "",
10 "disabled": false,
11 "created_at": "2016-06-20T08:20:36+00:00",
12 "updated_at": "2016-06-20T08:20:36+00:00",
13 "deleted_at": null
14}
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:

$ 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 "id": "6kEuoknxiaDBCLiAjKqyXq",
3 "service_id": "<service_id>",
4 "pool_id": "<pool_id>",
5 "weight": "100",
6 "max_conn": "200",
7 "port": "80",
8 "address": "<hostname_or_ip_address>",
9 "comment": "",
10 "disabled": false,
11 "created_at": "2016-06-20T08:20:36+00:00",
12 "updated_at": "2016-06-20T08:20:36+00:00",
13 "deleted_at": null
14}

To view a list of all origin servers attached to a particular pool, make the following API call in a terminal application:

$ 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 "id": "6kEuoknxiaDBCLiAjKqyXq",
4 "service_id": "<service_id>",
5 "pool_id": "<pool_id>",
6 "weight": "100",
7 "max_conn": "200",
8 "port": "80",
9 "address": "<hostname_or_ip_address>",
10 "comment": "",
11 "disabled": false,
12 "created_at": "2016-06-20T08:20:36+00:00",
13 "updated_at": "2016-06-20T08:20:36+00:00",
14 "deleted_at": null
15}
16]

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:

$ 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 "id": "6kEuoknxiaDBCLiAjKqyXq",
3 "service_id": "<service_id>",
4 "pool_id": "<pool_id>",
5 "weight": "100",
6 "max_conn": "200",
7 "port": "80",
8 "address": "<hostname_or_ip_address>",
9 "comment": "",
10 "disabled": false,
11 "created_at": "2016-06-20T08:20:36+00:00",
12 "updated_at": "2016-06-20T08:20:36+00:00",
13 "deleted_at": null
14}

Disabling an origin server

To disable an origin server, make the following API call in a terminal application:

$ 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 "id": "6kEuoknxiaDBCLiAjKqyXq",
3 "service_id": "<service_id>",
4 "pool_id": "<pool_id>",
5 "weight": "100",
6 "max_conn": "200",
7 "port": "80",
8 "address": "<hostname_or_ip_address>",
9 "comment": "",
10 "disabled": true,
11 "created_at": "2016-06-20T08:20:36+00:00",
12 "updated_at": "2016-06-20T08:20:36+00:00",
13 "deleted_at": null
14}

Deleting an origin server

To permanently delete an origin server, make the following API call in a terminal application:

$ 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 "status":"ok"
3}
NOTE

Pools must have at least one origin server. The API won't allow you to delete the last origin server in the pool.

Was this guide helpful?

Do not use this form to send sensitive information. If you need assistance, contact support@fastly.com.