Shared edge dictionaries


#1

Is it possible to have an edge dictionary within account but linked to multiple services, rather than just one?

The use-case I’m trying to solve is: I’d like to maintain a table of URL redirects, but have that list accessible from multiple services (e.g. development, staging and production) rather than maintaining the table twice and making multiple API calls to Fastly for every change to our data.

If this isn’t possible, would be great to hear if other customers have solved this and, if so, what their approach was.


#2

Hi Ryan,

Right now, we don’t have the concept of a shared edge dictionary that is accessible to multiple services. The same could be useful for ACLs and VCL snippets, and I hope we can support this in the future.


#3

Thanks Andrew. Yes – I agree it would be awesome elsewhere too :slight_smile:


#4

Hi Ryan,

You can easily manage this with the Postman Collection I have built for the Fastly API! I recommend following the instructions of the fastly-postman repository to get started.

First of all, I would use a dynamic snippet in order to manage your dictionary! You just need to configure your dictionary in the body for POST /service/service_id/version/version_no/snippet:

{
  "name": "your_dictionary",
  "priority": "10",
  "dynamic": "1",
  "content": "table your_dictionary {\n \"one\": \"one\", \n \"two\": \"two\", \n \"three\": \"three\" \n }",
  "type": "init"
}

This creates the following dynamic dictionary in VCL:

# Snippet Dynamic Dictionary: 10
table your_dictionary {
  "one": "one",
  "two": "two",
  "three": "three"
}

Clone the predefined Fasty environment for each of your services:

service_id: <service_id>
service_name: <service_name>
version_no: <version_no>

With this setup, you can easily switch the environment to create your dynamic dictionary on multiple services. Then you need to update the body of PUT /service/service_id/snippet/snippet_id:

{
  "content": "table your_dictionary {\n \"one\": \"one\", \n \"two\": \"two\", \n \"three\": \"three\", \n \"four\": \"four\" \n }"
}

This will update your dictionary to:

# Snippet Dynamic Dictionary: 10
table your_dictionary {
  "one": "one",
  "two": "two",
  "three": "three",
  "four": "four"
}

Like before you just need to switch the environment in order to make the change to any other service and version. Don’t forget to save your changes everytime you update the body of the PUT request!

If you need to update your dictionary again you just need to open Postman and update the body of the PUT request. Then save the request infromation and send the request to all the services you want to update by selecting the proper environment.

This concept allows you to share pretty much any configuration between all of your services! The best part is that Postman allows you to export your configuration so that anyone else can manage the dictionary if necessary!


#5

Thanks Philipp, but unfortunately, we manage hundreds of services with changes to the dictionaries being made throughout the day – so this isn’t something we can use Postman for in this way. We need to abstract changes to the dictionaries using our admin UI.

What I’m trying to avoid is every time a user makes a single change to redirects in their admin panel, having to make 3 API calls to update it on 3 separate Fastly services so that the user’s dev/staging/production environment stay in-sync.

Another way to envisage this is: imagine we had an IP blacklist for known attackers, we’d want to share that list amongst all our services, but we don’t want to have to replicate it individually for every one individually. We’d want all the services to reference a single master list.