Hosting a Static Site

Publish a static site to a public URL: create a bucket, upload your files, front it with a CDN resource, and get a live mamutecdn.com domain.

This guide takes you from an empty account to a live static site on a public URL. It chains the Storage and CDN APIs: you upload files to an object-storage bucket, then point a CDN resource at that bucket. A storage-backed CDN resource serves index.html by default.

Base URLs used here:

  • Management API: https://api.mamutecloud.com
  • S3 data plane: https://s3-us-east-1.mamutecloud.com (path-style, region us-east-1)
  • Public site URL: https://<subdomain>.mamutecdn.com

1. Create an API key

curl -X POST https://api.mamutecloud.com/security/apikey \
  -H "Authorization: Bearer $JWT" \
  -H "content-type: application/json" \
  -d '{"name": "deploy-key"}'

Store the returned key as MAMUTECLOUD_API_KEY. The name field is required.

2. Create a storage bucket

curl -X POST https://api.mamutecloud.com/storage/object-storage/buckets \
  -H "X-API-Key: $MAMUTECLOUD_API_KEY" \
  -H "content-type: application/json" \
  -d '{"name": "my-site", "storage_class": "Standard"}'

Returns a bucket with an id. Store it as BUCKET_ID.

3. Generate S3 credentials for the bucket

curl -X POST "https://api.mamutecloud.com/storage/object-storage/buckets/$BUCKET_ID/credentials" \
  -H "X-API-Key: $MAMUTECLOUD_API_KEY" \
  -H "content-type: application/json"

Returns access_key_id and secret_access_key. The secret is shown only once — store both securely.

4. Upload your files

Object I/O uses the S3 data plane, not the management API key. Point any AWS S3 SDK at the MamuteCloud S3 endpoint with the credentials from step 3.

Node.js (@aws-sdk/client-s3)

import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";

const s3 = new S3Client({
  endpoint: "https://s3-us-east-1.mamutecloud.com",
  region: "us-east-1",
  credentials: {
    accessKeyId: process.env.MAMUTECLOUD_S3_ACCESS_KEY,
    secretAccessKey: process.env.MAMUTECLOUD_S3_SECRET_KEY,
  },
  forcePathStyle: true,
});

await s3.send(new PutObjectCommand({
  Bucket: process.env.BUCKET_ID,
  Key: "index.html",
  Body: "<!doctype html><h1>Hello MamuteCloud</h1>",
  ContentType: "text/html",
}));

Python (boto3)

import boto3, os

s3 = boto3.client(
    "s3",
    endpoint_url="https://s3-us-east-1.mamutecloud.com",
    aws_access_key_id=os.environ["MAMUTECLOUD_S3_ACCESS_KEY"],
    aws_secret_access_key=os.environ["MAMUTECLOUD_S3_SECRET_KEY"],
    region_name="us-east-1",
)

s3.put_object(
    Bucket=os.environ["BUCKET_ID"],
    Key="index.html",
    Body=b"<!doctype html><h1>Hello MamuteCloud</h1>",
    ContentType="text/html",
)

Repeat for every asset (CSS, JS, images), preserving the paths you want in the final URLs.

5. Front the bucket with a CDN resource

Create a CDN resource whose origin group is the bucket. A storage-type origin group sets default_root_object to index.html automatically, so the root of your site serves that file.

curl -X POST https://api.mamutecloud.com/cdn/resource \
  -H "X-API-Key: $MAMUTECLOUD_API_KEY" \
  -H "content-type: application/json" \
  -d '{
        "name": "my-site",
        "origin_group": { "type": "storage", "bucket_id": "'"$BUCKET_ID"'" }
      }'

The response includes a distribution_domain like r-<tenantId>.mamutecdn.com and a status of in_progress. The distribution takes a few minutes to deploy; once status is active, the site is live.

6. Visit your site

https://r-<tenantId>.mamutecdn.com

This serves index.html at the root.

7. (Optional) Use a friendlier subdomain

curl -X PUT "https://api.mamutecloud.com/cdn/resource/$RESOURCE_ID" \
  -H "X-API-Key: $MAMUTECLOUD_API_KEY" \
  -H "content-type: application/json" \
  -d '{"distribution_domain": "my-site"}'

The site becomes https://my-site.mamutecdn.com. Check availability first with GET /cdn/resource/check-distribution-name.

For a fully custom domain (your own DNS), attach it through the resource custom_domains field on PUT /cdn/resource/{id} and point a CNAME at the distribution domain.

Related