Movatterモバイル変換


[0]ホーム

URL:


  1. Home
  2. Guides
  3. Core concepts

Linked resources for Fastly services

Some features of Fastly can be used to create resources that are sharable between Fastly services in the same account. Where resources are sharable (such as KV stores), you must create aresource link to connect them to each service from which you want to use that resource. Non-sharable resources (such as backends) are created and managed directly on the service to which they belong.

Shared resourcesNon-shared resources
KV stores
Secret stores
Config stores
ACLs on Compute
Backends
Dictionaries
ACLs
Domains
Health checks
Compute packages

Any number of services in the same account can be linked to any number of resources in the same account, using theResource API.

Using resource links with services

Create the shared resource, such as aKV store, and the Fastly service on which you wish to use that resource. For example, if you created a KV store, you could check that it exists by querying theKV stores API:

$ curl -X GET "https://api.fastly.com/resources/stores/kv" -H "Fastly-Key: YOUR_FASTLY_TOKEN" -H "Accept: application/json"
{
"data": [
{
"id": "5lom7wyacubg7hw0w3ulfb",
"name": "users-store",
"created_at": "2022-11-15T16:52:21.834Z",
"updated_at": "2022-11-15T16:52:21.834Z"
}
],
"meta": {
"limit": 100,
"total": 1
}
}

Armed with theid of the resource you want to link (from the output above) and the service ID of the service you want to link it to, the example below will create such a link:

$ curl -i -X POST "https://api.fastly.com/service/YOUR_FASTLY_SERVICE_ID/version/YOUR_FASTLY_SERVICE_VERSION/resource" -H "Fastly-Key: YOUR_FASTLY_TOKEN" -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: application/json" -d "name=users-store-linked-to-service-a&resource_id=5lom7wyacubg7hw0w3ulfb"
{
"id": "faF035op515mAy6FsRFqx0",
"name": "users-store-linked-to-service-a",
"service_id": "u4t1yYeyWKXxvcbfM0qml5",
"version": 1,
"created_at": "2022-11-16T11:58:43Z",
"updated_at": "2022-11-16T11:58:43Z",
"deleted_at": null,
"resource_id": "5lom7yacubg7hw0w3ulfb",
"resource_type": "kv-store",
"href": null
}

Note that the resource link itself also has a unique ID, separate from the service ID and KV store ID. When referencing the KV store from your code, use the link name, not the store name. See theResource API documentation for more information.

HINT: It is possible to use the same name for the resource link as for the resource itself. For example, you could have aconfig store calledconfig and also use that same name for the resource links that connect the config store to each service. However, if you rename the underlying resource, the name of the resource link will not change.

Limitations and constraints

The following limitations apply to resource links:

  • Each service can have a maximum of 50 resource links.
  • By default, a customer can only have 50 shared resources total.Contact support to discuss raising this limit.
  • The name of a resource link has the same naming constraints as the underlying resource that it connects to. For example a resource link for aconfig store cannot contain dashes (-) but those for aKV store, can.

[8]ページ先頭

©2009-2025 Movatter.jp