Last updated: 16 Apr 2025
Rotate Fastly automation token for Prometheus exporter
GOV.UK platform engineering has a Fastly account token for exporting Fastly metrics to Prometheus. The token is currently set to expire after a year.
Changing a Fastly automation tokens requires superuser
access. Ask someone
from govuk-platform-engineering@ or govuk-senior-tech-members@ to do this for
you.
It doesn’t matter who creates the token, as long as they have superuser access. Any superuser can delete or rotate any API token in the GOV.UK Fastly account.
Follow these steps to revoke old tokens and issue new one.
3 new tokens will be created to allow access to metrics for Integration, Staging and Production.
For the Integration environment follow these steps:
- Log into https://manage.fastly.com/.
- Go to Account tokens.
- Filter by the string “prometheus-fastly-exporter token for Integration” to narrow down the list.
- Delete the expiring tokens by pressing the trash bin icon in the rightmost column.
- Go to API tokens.
- Choose Create Token, near the top-right of the page. The UI may prompt you for your account password.
- Under Type, choose Automation token. Do not create a User token.
- Name the token
GOV.UK prometheus-fastly-exporter token for Integration
. - Leave the default Scope as
global:read
. Ensure nothing else is ticked under the Scope heading. - Under Access, choose One or more services and select all Services under the filter
Integration
. - Under Expiration, select 1 year after the current date.
- Choose Create Token.
- Copy the token and update the secret
govuk/fastly/prometheus-exporter
in AWS secrets manager for the Integration environment. - In Argo CD select the
monitoring-config
application and clickRefresh
on the external secret forfastly-exporter
to pick up the updated token. - Then select the
fastly-exporter
application and delete the runningfastly-exporter-prometheus
pod to trigger a deployment of a newfastly-exporter-prometheus
to use the new token. - Check that the token is being used by clicking on
Logs
for thefastly-exporter-prometheus
pod. If there are errors reported in theLogs
it might be that the token hasn’t been picked up properly so the external secret will need to be refreshed again and thefastly-exporter-prometheus
pod re-deployed. - Finally, wait for a couple of minutes and then check that metrics from Fastly are being exported to Prometheus by browsing to prometheus on Integration.
- Repeat these steps for Staging and Production.