NavigationContentFooter

Edge Services API

Introduction

Edge Services allows you to easily, securely and reliably expose your HTTP service to the internet via a single entry point. With Edge Services, you can enhance performance by enabling caching on Scaleway Object Storage buckets (S3) or Scaleway-Load Balancers, as well as customize your endpoints with your own domain and SSL/TLS certificate.

Note

This product is currently in Public Beta, and available for Object Storage buckets only. Load Balancer support will be coming at a later date.

Quickstart

This quickstart shows you how to set up Edge Services on a Scaleway Object Storage bucket (S3).

  1. Configure your environment variables.

    Note

    This is an optional step that seeks to simplify your usage of the Edge Services API.

    export SCW_SECRET_KEY="<API secret key>"
    export SCW_PROJECT_ID="<Scaleway Project ID>"
  2. Create a Backend Stage: run the following command to create a backend stage, which defines the origin service which Edge Services will point to. In this example, we point to a Scaleway Object Storage bucket called my-scw-bucket.

    curl -X POST \
    -H "X-Auth-Token: $SCW_SECRET_KEY" \
    "https://api.scaleway.com/edge-services/v1alpha1/backend-stages" \
    -d '{
    "project_id":"'$SCW_PROJECT_ID'",
    "scalewayS3":{
    "bucket_name":"my-scw-bucket",
    "bucket_region":"fr-par",
    "is_website":true
    }
    }'
  3. Create a Cache Stage: run the following command to create a cache stage, which defines the caching configuration for Edge Services on the previously-defined backend stage (origin). The example below sets the a custom TTL of 30 minutes for the cache. Ensure that you replace <BACKEND_STAGE_ID> with the ID of the previously created backend stage.

    curl -X POST \
    -H "X-Auth-Token: $SCW_SECRET_KEY" \
    "https://api.scaleway.com/edge-services/v1alpha1/cache-stages" \
    -d '{
    "project_id":"'$SCW_PROJECT_ID'",
    "fallback_ttl":"1800s",
    "backend_stage_id":"<BACKEND_STAGE_ID>"
    }'
  4. Create a TLS Stage: run the following command to create a TLS stage, which defines the SSL/TLS certificate for Edge Services on the previously-defined backend stage (origin). In the example below, an auto-created Saleway-managed Let's Encrypt certificate is configured. Ensure that you replace <CACHE_STAGE_ID> with the ID of the previously created cache stage.

    curl -X POST \
    -H "X-Auth-Token: $SCW_SECRET_KEY" \
    "https://api.scaleway.com/edge-services/v1alpha1/tls-stages" \
    -d '{
    "project_id":"'$SCW_PROJECT_ID'",
    "managed_certificate":true,
    "cache_stage_id":"<CACHE_STAGE_ID>"
    }'
  5. Create a DNS Stage: run the following command to create a DNS stage, which defines a custom domain as an endpoint for Edge Services on your backend stage (origin). You must already own the domain. In the example below we use myendpoint.example.com. Ensure that you replace <TLS_STAGE_ID> with the ID of the previously created TLS stage.

    curl -X POST \
    -H "X-Auth-Token: $SCW_SECRET_KEY" \
    "https://api.scaleway.com/edge-services/v1alpha1/dns-stages" \
    -d '{
    "project_id":"'$SCW_PROJECT_ID'",
    "fqdns":["myendpoint.example.com"],
    "tls_stage_id":"<TLS_STAGE_ID>"
    }'
  6. Create a Pipeline: run the following command to create a pipeline containing the previously-created stages. This pipeline is the main Edge Services object and represents how an HTTP request to your Object Storage bucket via Edge Services will be processed. Ensure that you replace <DNS_STAGE_ID> with the ID of the previously created DNS stage.

    curl -X POST \
    -H "X-Auth-Token: $SCW_SECRET_KEY" \
    "https://api.scaleway.com/edge-services/v1alpha1/pipelines" \
    -d '{
    "project_id":"'$SCW_PROJECT_ID'",
    "name":"mypipeline",
    "description":"my-pipeline",
    "dns_stage_id":"<DNS_STAGE_ID>"
    }'
  7. Access your endpoint: run the following command to test your pipeline. Ensure that you customize the URL according to the domain you set in step 5, and that you replace myimage.png with an appropriate filename that is actually in your Object Storage bucket. You can also test the URL through your web browser. Edge Services will serve the requested object. Once your content is cached, you can inspect the HTTP header X-Cache and see that the response is hit-fresh.

    curl -i https://myendpoint.example.com/myimage.png
  8. Delete your pipeline: run the following command to delete a pipeline. Ensure that you replace <PIPELINE_ID> in the URL with the ID of the pipeline you want to delete. Note that it will also delete all of the associated stages.

    curl -X DELETE \
    -H "X-Auth-Token: $SCW_SECRET_KEY" \
    "https://api.scaleway.com/edge-services/v1alpha1/pipelines/<PIPELINE_ID>"
Requirements
  • You have a Scaleway account
  • You have created an API key and that the API key has sufficient IAM permissions to perform the actions described on this page
  • You have installed curl
  • You have created a Scaleway Object Storage bucket

Technical information

Availability

Scaleway Edge Services is currently available globally. Find out about product availability in our dedicated documentation.

Edge Services is currently available for Scaleway Object Storage backends only.

Pipeline Stages

An Edge Services pipeline contains a set of interlinked stages.

The following links are possible :

  • Pipeline > DNS stage > TLS stage > Cache stage > Backend stage
  • Pipeline > DNS stage > TLS stage > Backend stage

If you wish to set up Edge Services without customizing the domain (that is, using the default endpoint), you can create empty TLS and DNS stages and pass them to the pipeline.

  • Create the TLS stage with only the project_id and backend_stage_id (or cache_stage_id if caching feature is needed) parameters.
  • Create the DNS stage with only the project_id and tls_stage_id parameters.

Technical limitations

  • A backend stage must point either to a Scaleway Object Storage bucket (scalewayS3) or to a Scaleway Load Balancer (scalewayLb)
  • Only one pipeline is allowed per Object Storage bucket
  • The TLS stage currently only supports one SSL/TLS certificate
  • The DNS stage currently only supports one FQDN (Fully Qualified Domain Name)

Going further

For more help using Scaleway Edge Services, check out the following resources:

  • Our main documentation
  • The #edge-services-beta channel on our Slack Community
  • Our support ticketing system.

Pipelines

The main Edge Services object. A pipeline is made up of ordered stages and represents how an HTTP request will be processed, from the source (client) to the destination (origin).

GET
/edge-services/v1alpha1/pipelines
POST
/edge-services/v1alpha1/pipelines
GET
/edge-services/v1alpha1/pipelines/{pipeline_id}
PATCH
/edge-services/v1alpha1/pipelines/{pipeline_id}
DELETE
/edge-services/v1alpha1/pipelines/{pipeline_id}

DNS stages

A DNS stage is part of a pipeline. It allows you to customize the domain of your Edge Services endpoint with a subdomain of a domain you own. This is useful if you do not want to use the default domain endpoint provided by Scaleway. Edge Services will then serve content from your customized domain. A TLS stage is also necessary to provide an SSL/TLS certificate so that Edge Services can serve traffic for your customized domain over HTTPS.

GET
/edge-services/v1alpha1/dns-stages
POST
/edge-services/v1alpha1/dns-stages
GET
/edge-services/v1alpha1/dns-stages/{dns_stage_id}
PATCH
/edge-services/v1alpha1/dns-stages/{dns_stage_id}
DELETE
/edge-services/v1alpha1/dns-stages/{dns_stage_id}

TLS stages

A TLS stage is part of a pipeline. It allows you to provide an SSL/TLS certificate for your customized domain (DNS stage) - without this, Edge Services cannot serve traffic for your customized domain over HTTPS. This could be a custom certificate stored in Scaleway Secret Manager, or a Let's Encrypt certificate generated and managed by Scaleway.

GET
/edge-services/v1alpha1/tls-stages
POST
/edge-services/v1alpha1/tls-stages
GET
/edge-services/v1alpha1/tls-stages/{tls_stage_id}
PATCH
/edge-services/v1alpha1/tls-stages/{tls_stage_id}
DELETE
/edge-services/v1alpha1/tls-stages/{tls_stage_id}

Cache stages

A cache stage is part of a pipeline. It allows you to cache your origin's content, so it will be served directly to users from a cache on Edge Services' servers, enhancing performance. Note that including a cache stage in your pipeline is optional.

GET
/edge-services/v1alpha1/cache-stages
POST
/edge-services/v1alpha1/cache-stages
GET
/edge-services/v1alpha1/cache-stages/{cache_stage_id}
PATCH
/edge-services/v1alpha1/cache-stages/{cache_stage_id}
DELETE
/edge-services/v1alpha1/cache-stages/{cache_stage_id}

Backend stages

A backend stage is part of a pipeline. It defines the source of the content that Edge Services will serve to clients. It could be either a Scaleway Object Storage bucket ("S3") or a Scaleway Load Balancer.

GET
/edge-services/v1alpha1/backend-stages
POST
/edge-services/v1alpha1/backend-stages
GET
/edge-services/v1alpha1/backend-stages/{backend_stage_id}
PATCH
/edge-services/v1alpha1/backend-stages/{backend_stage_id}
DELETE
/edge-services/v1alpha1/backend-stages/{backend_stage_id}

Purge requests

A purge request allows you to remove content from the cache (if a cache stage has been created). You can choose to purge the entire cache, or limit the purge to specified assets.

GET
/edge-services/v1alpha1/purge-requests
POST
/edge-services/v1alpha1/purge-requests
GET
/edge-services/v1alpha1/purge-requests/{purge_request_id}
Docs APIScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCarreer
© 2023-2024 – Scaleway