Preview
This product or feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the Service Specific Terms. Pre-GA products and features are available "as is" and might have limited support. For more information, see the launch stage descriptions.
This page describes how to deploy Service Extensions plugins in Media CDN routes.
You can use Media CDN with Service Extensions to add custom code to the request-response processing path. Such customization unlocks a wide variety of lightweight use cases.
For more information about Service Extensions concepts, see Service Extensions overview.
Before you begin
Deploy a Service Extensions plugin in a Media CDN route
To deploy a Service Extensions plugin in a Media CDN route, follow these steps:
To export the current configuration of your service to a YAML file, run the
gcloud edge-cache services exportcommand:gcloud edge-cache services export SERVICE_NAME \ --destination=FILENAME.yamlReplace the following:
SERVICE_NAME: the name of the Media CDN serviceFILENAME: the name of the YAML file
In Cloud Shell, use a text editor to edit the YAML file.
Update the routes in the file to add the
wasmActionheader as shown in the following example:name: SERVICE_NAME routing: hostRules: - hosts: - DOMAIN_NAME pathMatcher: routes pathMatchers: - name: routes routeRules: - priority: '1' description: Route 1 matchRules: - prefixMatch: /plugins origin: projects/PROJECT_NUMBER/locations/global/edgeCacheOrigins/ORIGIN_NAME routeAction: wasmAction: projects/PROJECT_NUMBER/locations/global/wasmActions/WASM_ACTIONReplace the following:
SERVICE_NAME: the name of the Media CDN serviceDOMAIN_NAME: the domain of the Media CDN servicePROJECT_NUMBER: the project numberORIGIN_NAME: the origin for the contentWASM_ACTION: the Service Extensions Wasm action
Save the YAML file.
Run the
gcloud edge-cache services importcommand:gcloud edge-cache services import SERVICE_NAME \ --source=FILENAME.yaml
What's next
- Learn more about Service Extensions concepts.
- Learn how to prepare and upload the files required to create plugins by using Service Extensions.
- Learn how to create a plugin.