Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Tutorials
    • All tutorials
        • Overview
        • Management console, CLI, and API
        • Terraform
      • Transferring a WordPress website from a different hosting provider to Yandex Cloud
      • Setting up virtual hosting
      • Creating a Python web application with Flask
      • Hosting a static Gatsby website
      • Migrating to Cloud CDN from a third-party CDN provider
      • Getting website traffic statistics with S3 Select

In this article:

  • Getting started
  • Required paid resources
  • Add a certificate to Certificate Manager
  • Create a bucket in Object Storage and upload your website files to it
  • Set up static website hosting
  • Create a CDN resource
  • Configure DNS for the CDN resource
  • Test the CDN
  • How to delete the resources you created
  1. Application solutions
  2. Creating a website
  3. Static website in Object Storage with access via Cloud CDN
  4. Management console, CLI, and API

Setting up static website hosting in a Yandex Object Storage bucket with Yandex Cloud CDN access

Written by
Yandex Cloud
Updated at November 27, 2025
  • Getting started
    • Required paid resources
  • Add a certificate to Certificate Manager
  • Create a bucket in Object Storage and upload your website files to it
  • Set up static website hosting
  • Create a CDN resource
  • Configure DNS for the CDN resource
  • Test the CDN
  • How to delete the resources you created

To set up static website hosting in a bucket with CDN access using the Yandex Cloud management console, CLI, or API:

  1. Get your cloud ready.
  2. Add a certificate to Certificate Manager.
  3. Create a bucket in Object Storage and upload your website files to it.
  4. Set up static website hosting.
  5. Create a CDN resource.
  6. Configure DNS for the CDN resource.
  7. Test the CDN.

If you no longer need the resources you created, delete them.

Getting startedGetting started

Sign up for Yandex Cloud and create a billing account:

  1. Navigate to the management console and log in to Yandex Cloud or create a new account.
  2. On the Yandex Cloud Billing page, make sure you have a billing account linked and it has the ACTIVE or TRIAL_ACTIVE status. If you do not have a billing account, create one and link a cloud to it.

If you have an active billing account, you can navigate to the cloud page to create or select a folder for your infrastructure.

Learn more about clouds and folders here.

Required paid resourcesRequired paid resources

The infrastructure support cost for a bucket-hosted site with CDN access includes:

  • A fee for outgoing traffic from CDN servers (see Cloud CDN pricing).
  • Fee for data storage in Object Storage, data operations, and outbound traffic (see Object Storage pricing).
  • Fee for public DNS requests and DNS zones if using Yandex Cloud DNS (see Cloud DNS pricing).

Add a certificate to Certificate ManagerAdd a certificate to Certificate Manager

Certificates from Yandex Certificate Manager are supported. You can issue a new Let's Encrypt® certificate or upload one of your own.

The certificate must be located in the same folder as your CDN resource.

For a Let's Encrypt® certificate, pass an ownership check for the domain specified in the certificate.

Create a bucket in Object Storage and upload your website files to itCreate a bucket in Object Storage and upload your website files to it

Management console
Yandex Cloud CLI
API
  1. In the management console, select Object Storage.
  2. At the top right, click Create bucket.
  3. In the ** Name** field, enter a name for the bucket, e.g., example.com.
  4. Click Create bucket.
  5. Create a website home page file named index.html on your computer.

    Example of the index.html file
    <!DOCTYPE html>
    <html>
      <head>
        <title>My site</title>
      </head>
      <body>
        <p>The site is working</p>
      </body>
    </html>
    
  6. On the bucket page, click Upload and select index.html.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

  1. Create a bucket in the default folder:

    yc storage bucket create --name <bucket_name> \
      --public-read \
      --public-list
    

    Where:

    • --name: Bucket name, e.g., example.com. This is a required parameter. For more information, see Bucket naming rules.
    • --public-read: Enables public read access to bucket objects.
    • --public-list: Enables public view access to the list of bucket objects.

    Result:

    name: example.com
    folder_id: b1geoelk7fld********
    anonymous_access_flags:
      read: true
      list: true
    default_storage_class: STANDARD
    versioning: VERSIONING_DISABLED
    created_at: "2025-10-26T17:38:54.635027Z"
    resource_id: e3ef9cmb253k********
    
  2. Create a website home page file named index.html on your computer.

    Example of the index.html file
    <!DOCTYPE html>
    <html>
      <head>
        <title>My site</title>
      </head>
      <body>
        <p>The site is working</p>
      </body>
    </html>
    
  3. Upload the main page file to the bucket:

    yc storage s3api put-object \
      --body <local_file_path> \
      --bucket <bucket_name> \
      --key <object_path>
    

    Where:

    • --body: Path to the file you need to upload to the bucket, e.g., index.html.
    • --bucket: Bucket name, e.g., example.com.
    • --key: Key by which to store the object in the bucket, e.g., index.html.

    Result:

    etag: '"b810d087812333c7dd9cfa80********"'
    request_id: 8e8714b8********
    
  1. To create a bucket, use the create REST API method for the Bucket resource, the BucketService/Create gRPC API call, or the create S3 API method.

  2. Create a website home page file named index.html on your computer.

    Example of the index.html file
    <!DOCTYPE html>
    <html>
      <head>
        <title>My site</title>
      </head>
      <body>
        <p>The site is working</p>
      </body>
    </html>
    
  3. To upload the home page of the website, use the upload S3 API method.

Set up static website hostingSet up static website hosting

Management console
Yandex Cloud CLI
API
  1. In the management console, select Object Storage from the list of services and go to the bucket you want to configure hosting for.
  2. In the left-hand panel, select Settings.
  3. Navigate to the General tab.
  4. In the Read objects and Read object list fields, select For all.
  5. Click Save.
  6. Select the Website tab.
  7. Under Hosting, in the Home page field, specify the absolute path to the file in the bucket for the website home page, e.g., index.html.
  8. Click Save.

Use the link in Link to check the hosting.

  1. Set the hosting parameters for the bucket:

    yc storage bucket update --name <bucket_name> \
      --website-settings '{"index":"index.html"}'
    

    Where --name is the bucket name.

    Result:

    name: example.com
    folder_id: b1geoelk7fld********
    default_storage_class: STANDARD
    versioning: VERSIONING_DISABLED
    acl: {}
    created_at: "2025-10-26T17:38:54.635027Z"
    website_settings:
      index: index.html
      redirect_all_requests: {}
    resource_id: e3ef9cmb253k********
    

To set up hosting for a static website, use the update REST API method for the Bucket resource, the BucketService/Update gRPC API call, or the upload S3 API method.

Create a CDN resourceCreate a CDN resource

Management console
Yandex Cloud CLI
API
  1. In the management console, select Cloud CDN.
  2. Click Create resource.
  3. Configure the basic CDN resource settings:
    • Under Content:

      • Enable Enable access to content.

      • In the Content query field, select From one origin.

      • In the Origin type field, select Bucket.

      • In the Bucket field, select the bucket you need from the list.

      • Enable Use bucket site.

      • In the Origin request protocol field, select HTTP.

      • In the Domain name field, enter the domain name, e.g., cdn.yandexcloud.example.

        Alert

        The cdn.yandexcloud.example domain name will become the primary one, and you will not be able to edit it after you create a CDN resource.

    • Under Additional settings:

      • In the Redirect clients field, select HTTP to HTTPS.
      • In the Certificate type field, specify Use from Certificate Manager and select a certificate for the cdn.yandexcloud.example domain name.
      • In the Host header field, select Custom and, in Header value, specify the origin domain name in <name_of_bucket_with_files>.website.yandexcloud.net format for the source bucket to respond to CDN server requests correctly.
  4. Click Continue.
  5. Keep the default settings for Caching, HTTP headers and methods, and Additional settings and click Create and continue.
  1. Create an origin group:

    yc cdn origin-group create \
      --name <origin_group_name> \
      --origin source=<name_of_bucket_with_files>.website.yandexcloud.net,enabled=true
    

    Where:

    • --name: Origin group name.
    • --origin source: Origin domain name in <name_of_bucket_with_files>.website.yandexcloud.net format, e.g., example.com.website.yandexcloud.net.

    Result:

    folder_id: b1geoelk7fld********
    name: mys3-origin
    use_next: true
    origins:
      - id: "27904"
        origin_group_id: "42742158888********"
        source: example.com.website.yandexcloud.net
        enabled: true
        provider_type: ourcdn
    provider_type: ourcdn
    
  2. Create a CDN resource:

    yc cdn resource create \
      --cname <cdn_domain_name> \
      --origin-group-id <origin_group_ID> \
      --origin-protocol http \
      --cert-manager-ssl-cert-id <TLS_certificate_ID> \
      --host-header <name_of_bucket_with_files>.website.yandexcloud.net
    

    Where:

    • --cname: CDN resource domain name, e.g., cdn.example.com.
    • --origin-group-id: ID of the origin group for CDN created in the previous step.
    • --origin-protocol: Protocol the CDN resource will use to communicate with the origin, specify http.
    • --cert-manager-ssl-cert-id: TLS certificate ID that you saved earlier when creating the certificate.
    • --host-header: The Host header value. For the source bucket to respond to CDN server requests correctly, specify the origin domain name in <name_of_bucket_with_files>.website.yandexcloud.net format, e.g., example.com.website.yandexcloud.net.
    Result
    id: bc8r4l7awapj********
    folder_id: b1geoelk7fld********
    cname: cdn.example.com
    created_at: "2025-10-26T17:45:08.171948Z"
    updated_at: "2025-10-26T17:45:08.171948Z"
    active: true
    options:
      edge_cache_settings:
        enabled: true
        default_value: "86400"
      browser_cache_settings: {}
      query_params_options:
        ignore_query_string:
          enabled: true
          value: true
      slice: {}
      host_options:
        host:
          enabled: true
          value: example.com.website.yandexcloud.net
      static_headers:
        enabled: true
      stale: {}
      allowed_http_methods:
        enabled: true
        value:
          - GET
          - HEAD
          - OPTIONS
      proxy_cache_methods_set:
        enabled: true
      disable_proxy_force_ranges:
        enabled: true
        value: true
      static_request_headers:
        enabled: true
      custom_server_name: {}
      ignore_cookie:
        enabled: true
        value: true
      secure_key:
        type: DISABLE_IP_SIGNING
    origin_group_id: "42742158888********"
    origin_group_name: mys3-origin
    origin_protocol: HTTP
    ssl_certificate:
      type: CM
      status: READY
      data:
        cm:
          id: fpq4nl8g1c4h********
    provider_type: ourcdn
    provider_cname: b5384481********.a.yccdn.cloud.yandex.net
    

To create a CDN resource, use the create REST API method for the Resource resource or the ResourceService/Create gRPC API call.

Warning

After the CDN resource is set up, it may take up to 15 minutes for it to go live.

Make sure the new CDN resource is fully functional before proceeding with the next steps.

Configure DNS for the CDN resourceConfigure DNS for the CDN resource

The cdn.yandexcloud.example domain name must be mapped to the CDN using DNS records.

To set up DNS for a CDN resource:

  1. Get the Cloud CDN provider domain name:

    Management console
    1. In the management console, select Cloud CDN.
    2. From the list of CDN resources, select the one with cdn.yandexcloud.example as its primary domain name.
    3. From DNS settings at the bottom of the page, copy the domain name in 328938ed********.a.yccdn.cloud.yandex.net or cl-msa87*****.edgecdn.ru format depending on your CDN provider.
  2. On the website of your DNS hosting provider, navigate to the DNS settings.

  3. Create or edit a CNAME record for cdn.yandexcloud.example so that it points to the domain name you copied:

    cdn CNAME 328938ed********.a.yccdn.cloud.yandex.net
    

    Note

    Do not use an ANAME resource record with domain names for content distribution; otherwise, the end user will get a response from a CDN server not linked to the user geolocation. The response will always be the same for all users.

    If you use Cloud DNS, follow this guide to configure the record:

    Configuring DNS records for Cloud DNS
    Management console
    1. In the management console, select Cloud DNS.

    2. If you do not have a public DNS zone, create one:

      1. Click Create zone.
      2. In the Zone field, enter the website domain name with a trailing dot: yandexcloud.example..
      3. In the Type field, select Public.
      4. In the Name field, specify example-dns-zone.
      5. Click Create.
    3. Create a CNAME record for cdn.yandexcloud.example in the zone:

      1. Select example-dns-zone.
      2. Click Create record.
      3. In the Name field, specify cdn.
      4. In the Type field, specify CNAME.
      5. In the Data field, paste the copied value in 328938ed********.a.yccdn.cloud.yandex.net. or cl-msa87*****.edgecdn.ru. format (depending on your CDN provider) with a trailing dot.
      6. Click Create.

Test the CDNTest the CDN

Wait for the DNS records to get updated (this may take several hours).

Check if the website is accessible: use the new URL, cdn.example.com, to open it. You should be redirected to the https://cdn.example.com website with a TLS certificate from Certificate Manager already connected and content sourced from Cloud CDN.

How to delete the resources you createdHow to delete the resources you created

To shut down the infrastructure and stop paying for the resources you created:

  1. Delete the DNS zone named example-dns-zone if you created it in Cloud DNS.
  2. Delete the CDN resource with cdn.yandexcloud.example as its primary domain name.
  3. Delete all objects from the bucket.
  4. Delete the bucket.

See alsoSee also

  • Setting up static website hosting in a Yandex Object Storage bucket with Yandex Cloud CDN access using Terraform

Was the article helpful?

Previous
Overview
Next
Terraform
© 2025 Direct Cursus Technology L.L.C.