Skip to main content

Bucket claim website (S3 Website)

Website serves the bucket’s objects as a static site on the website endpoint. You set it on the bucket claim in a namespace — from the console or with kubectl.

warning

The website endpoint is anonymous. For the site to actually load, you also need a bucket policy that Allows "*" with s3:GetObject. Without that, the site usually answers 403.

tip

indexDocument.suffix is appended to a directory path (for example /docs/ → docs/index.html). errorDocument.key is a full key from the bucket root, not a suffix.

Set from the console​

Website tab in the console

  1. Open your workspace, then open a namespace.
  2. In the namespace nav, under Object Storage, open Bucket claims.
  3. Open the claim.
  4. Select the Website tab.
  5. Click Serve as a website.
  6. Fill in:
    • Index document — for example index.html (required; must not contain /)
    • Error document (optional) — for example 404.html (full key)
  7. If you see Nothing will be served, add public read access on the Policy tab first.
  8. Click Save website.
  9. Copy the address from Website URL on this tab (or Overview).

Stop serving as a website​

Click Stop serving as a website, then Save website. Website configuration is removed; objects are left untouched.

Set with kubectl​

Set spec.website on the same S3BucketClaim:

zsh
❯ kubectl -n <namespace> apply -f - <<EOF
❯ apiVersion: oss.tapsicloud.com/v1alpha1
❯ kind: S3BucketClaim
❯ metadata:
❯ name: app-data
❯ spec:
❯ website:
❯ indexDocument:
❯ suffix: index.html
❯ errorDocument:
❯ key: 404.html
❯ EOF

Replace <namespace> with your namespace. Assumes your workspace kubeconfig and context are already configured.

Publish for anonymous readers​

Without this policy, the website is configured but answers 403 publicly:

!manifest.yaml×
tapsicloud › manifest.yaml
1apiVersion: oss.tapsicloud.com/v1alpha1
2kind: S3BucketClaim
3metadata:
4 name: app-data
5spec:
6 website:
7 indexDocument:
8 suffix: index.html
9 errorDocument:
10 key: 404.html
11 bucketPolicy:
12 statements:
13 - effect: Allow
14 principals: ["*"]
15 actions: ["s3:GetObject"]
✓ dry-runLn 15 · YAML

Fields​

FieldIn plain terms
website.indexDocument.suffixIndex file name (for example index.html); no /
website.errorDocument.key (optional)Full error-page key from the bucket root
status.websiteURLSite URL (when Website is set and the platform has an endpoint)
warning

If the platform has no website endpoint, or static websites are disabled on the cluster, Website configuration will have no public address to visit.

Clear website​

zsh
❯ kubectl -n <namespace> patch s3bucketclaim app-data --type=merge -p '{"spec":{"website":null}}'