Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
huaweicloud avatar

Huawei Cloud Obs Website Host

  • 93 installs
  • 19 repo stars
  • Updated July 31, 2026
  • huaweicloud/huaweicloud-skills

Configure Huawei Cloud OBS static website hosting: enable hosting, set index/error pages, allow public read, and connect a custom domain via DNS.

About

Configures an existing Huawei Cloud OBS bucket for static website hosting using the OBS Python SDK, setting index/error documents, public-read access, and custom-domain CNAME via Huawei Cloud DNS. A developer uses it to serve a static site from OBS and diagnose 403/404/DNS issues.

  • Enables hosting with index/error pages and public read
  • Custom-domain DNS setup and 403/404 diagnosis

Huawei Cloud Obs Website Host by the numbers

  • 93 all-time installs (skills.sh)
  • +14 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #578 of 1,042 Cloud & Infrastructure skills by installs in the Skillselion catalog
  • Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/huaweicloud/huaweicloud-skills --skill huawei-cloud-obs-website-host

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs93
repo stars19
Last updatedJuly 31, 2026
Repositoryhuaweicloud/huaweicloud-skills

What it does

Configure Huawei Cloud OBS static website hosting: enable hosting, set index/error pages, allow public read, and connect a custom domain via DNS.

Files

SKILL.mdMarkdownGitHub ↗

Huawei Cloud OBS Website Host

Overview

Configure an existing Huawei Cloud OBS bucket for static website hosting with Huawei Cloud OBS Python SDK.

Use this skill when the user wants to:

  • enable or repair OBS static website hosting
  • set an index document or error document
  • make the site reachable through the OBS static website endpoint
  • add a custom domain with Huawei Cloud DNS
  • diagnose 403, 404, or DNS issues on a hosted OBS site

What Good Looks Like

  • The bucket has static website hosting enabled.
  • The bucket can serve index.html from the website endpoint.
  • Anonymous users can read the website content.
  • A missing path returns the configured error page or a clean 404.
  • A custom domain resolves to the OBS website endpoint through DNS.
  • A custom domain is strongly recommended; using the default OBS domain in a browser may download web assets as attachments instead of rendering them inline.
  • The OBS website endpoint is used, not the regular bucket API endpoint.
  • A 403 usually means anonymous access or bucket policy is missing.
  • A 404 usually means the index document name or upload path is wrong.

Required Inputs

Collect these before making changes:

  • region
  • bucket_name
  • index_document (optional, default: index.html)
  • error_document (optional)
  • custom_domain (optional)
  • dns_zone or DNS account context (optional, only if the user wants DNS changes)

Assume static website files are already uploaded by the user.

Dependencies

The skill depends on the following runtime/tooling components:

  • Python 3.8+ (required for scripts/set_obs_website_sdk.py and scripts/verify_obs_website.py)
  • Huawei OBS Python SDK package: esdk-obs-python
  • obsutil (for generating and maintaining .obsutilconfig credential config)
  • Huawei Cloud AK/SK credentials (from .obsutilconfig)
  • Network access to OBS endpoint and website endpoint
  • hcloud CLI (optional for DNS helper steps, especially Huawei Cloud DNS record operations)

Install command:

pip install esdk-obs-python

hcloud CLI Reference

Load references/hcloud-install-config.md when hcloud CLI installation or AK/SK configuration is needed. Load references/hcloud-dns-obs-website.md when creating or managing DNS CNAME records for OBS static website custom domains (step-by-step guide with hcloud DNS CreateRecordSet commands).

Security note:

  • Never hardcode AK/SK in scripts or checked-in files.
  • Prefer environment variables for SDK scripts and secure local profile storage for CLI use.

obsutil Config Dependency

Load references/obsutil-install-config.md when you need obsutil installation or .obsutilconfig setup guidance.

The Python SDK helper script (scripts/set_obs_website_sdk.py) reads credentials by default from: 1. CLI flags (--access-key, --secret-key, --security-token) 2. Environment variables (HW_ACCESS_KEY, HW_SECRET_KEY, HW_SECURITY_TOKEN) 3. .obsutilconfig

If ak/sk are empty across all sources, the script must stop and ask the user to fill missing keys in .obsutilconfig (or provide CLI/env credentials).

Credential check rule:

  • Only report presence/absence of keys (ak, sk, securitytoken).
  • Never print credential values during checks.
  • Never print full lines from .obsutilconfig to console.
  • Treat console output as model context; any leaked value is a security incident.

Safe check examples (status only, no secret values):

Linux/macOS:

CFG="${HOME}/.obsutilconfig"
if [ ! -f "$CFG" ]; then
  echo "obsutilconfig_exists=false"
  echo "ak_configured=false"
  echo "sk_configured=false"
  echo "securitytoken_configured=false"
else
  awk -F= '
    BEGIN { ak=0; sk=0; st=0 }
    /^[[:space:]]*#/ { next }
    /^[[:space:]]*(ak|access_key_id)[[:space:]]*=/ { if ($2 ~ /[^[:space:]]/) ak=1 }
    /^[[:space:]]*(sk|secret_access_key)[[:space:]]*=/ { if ($2 ~ /[^[:space:]]/) sk=1 }
    /^[[:space:]]*(securitytoken|security_token|token)[[:space:]]*=/ { if ($2 ~ /[^[:space:]]/) st=1 }
    END {
      print "obsutilconfig_exists=true"
      print "ak_configured=" (ak ? "true" : "false")
      print "sk_configured=" (sk ? "true" : "false")
      print "securitytoken_configured=" (st ? "true" : "false")
    }
  ' "$CFG"
fi

Windows (PowerShell):

$cfg = Join-Path $HOME ".obsutilconfig"
if (-not (Test-Path $cfg)) {
  "obsutilconfig_exists=false"
  "ak_configured=false"
  "sk_configured=false"
  "securitytoken_configured=false"
} else {
  $lines = Get-Content $cfg
  $ak = $false; $sk = $false; $st = $false
  foreach ($line in $lines) {
    if ($line -match '^\s*#') { continue }
    if ($line -match '^\s*(ak|access_key_id)\s*=\s*(\S.*)$') { $ak = $true }
    if ($line -match '^\s*(sk|secret_access_key)\s*=\s*(\S.*)$') { $sk = $true }
    if ($line -match '^\s*(securitytoken|security_token|token)\s*=\s*(\S.*)$') { $st = $true }
  }
  "obsutilconfig_exists=true"
  "ak_configured=$ak"
  "sk_configured=$sk"
  "securitytoken_configured=$st"
}

Do not use:

  • cat ~/.obsutilconfig
  • grep -E "ak|sk|token" ~/.obsutilconfig

Script Usage Intent

Use the bundled scripts by default for the tasks they were built for:

  • scripts/set_obs_website_sdk.py applies or updates the bucket website configuration. Use it whenever the task is to enable, repair, or change OBS static website hosting settings.
  • scripts/verify_obs_website.py validates the published website endpoint. Use it after any website configuration change, and also when the user asks whether the site is reachable or when troubleshooting 403/404 behavior.
  • Do not replace these scripts with ad hoc one-off code unless the script itself is broken and must be patched.
  • Use the scripts to keep credential handling, SDK object construction, and verification behavior consistent across runs.

Workflow

1. Verify Python runtime and OBS SDK are available (pip install esdk-obs-python if missing). 2. If the user requests a custom domain and DNS changes, verify hcloud is installed and authenticated. If no custom domain/DNS change is needed, do not treat hcloud as a blocker. 3. Verify the bucket exists in the requested region (use Bucket Existence and Region Check Method below). 4. Check that the caller has permission to update bucket website settings. 5. Check that anonymous read is allowed for the website files (use the method in Anonymous Read Check Method below). 6. Do not upload or modify website content objects (index.html, assets, etc.). Assume content already exists in the bucket. 7. Configure static website hosting by running scripts/set_obs_website_sdk.py (use index.html if index_document is not provided).

  • The script exists to keep SDK object construction and credential lookup consistent.
  • Use it instead of writing a one-off SDK call in the response.

8. If a custom domain is provided, register it on the bucket via the OBS SDK path used by the script:

  • client.setBucketCustomDomain(bucket_name, custom_domain) — required even if DNS CNAME already exists.
  • If DNS record changes are requested in this run, create a DNS CNAME record to the OBS website endpoint and wait for propagation. (read references/hcloud-dns-obs-website.md)
  • If DNS is managed outside this run, treat DNS creation as an external prerequisite instead of failing website-hosting configuration steps.

9. Verify the published site by running scripts/verify_obs_website.py <site_url> [--index-document <name>]. 10. Confirm the root path returns the homepage (HTTP 200). 11. Confirm a missing path returns the configured error behavior (HTTP 404 or configured error page). 12. For a custom domain, verify DNS resolution (dig / nslookup) and HTTP access through the custom domain.

Bucket Existence and Region Check Method

Run a read-only SDK check with verify_obs_website.py before website configuration.

python scripts/verify_obs_website.py "<site_url>" \
  --bucket-name "<bucket_name>" \
  --expected-region "<region>" \
  --index-document "<index_document>"

obs endpoint is auto-built as https://obs.<region>.myhuaweicloud.com.

Pass/Fail rules:

  • PASS: headBucket is 2xx and region matches (or region cannot be returned but bucket is reachable with 2xx).
  • FAIL: headBucket non-2xx, getBucketLocation non-2xx, or explicit region mismatch.

Anonymous Read Check Method

Use anonymous HTTP requests against the OBS website endpoint (no AK/SK) as the source of truth.

1. Build website URL:

  • site_url="http://<bucket_name>.obs-website.<endpoint>"

2. Run bundled verifier (preferred):

python scripts/verify_obs_website.py "$site_url" --index-document "<index_document>"

3. If you need a quick single-file check, run:

curl -s -o /dev/null -w "%{http_code}\n" "$site_url/<index_document>"

Pass/Fail rules:

  • 200 on root_path and index_document: anonymous read is working.
  • 403: anonymous read is not enabled (ACL/policy issue).
  • 404: object path/name issue (for example, index.html missing or key path mismatch), not an anonymous-permission success.

When 403 appears, treat setup as failed and provide remediation via references/iam-policies.md.

Response Shape

Always return: 1. Input summary 2. Actions performed 3. Verification results 4. Remediation steps if anything failed

Safety Rules

  • Never print secrets, AK/SK, or tokens.
  • Do not claim success until the website endpoint is verified.
  • If permissions are missing, stop and report the missing capability.
  • If DNS is requested but the zone is unknown, ask for the zone instead of guessing.
  • Do not use the regular bucket endpoint as the final website result.
  • If the bucket name contains dots, warn that HTTPS access can be problematic.
  • obsutil is allowed only for managing ~/.obsutilconfig; do not use it to configure website hosting.
  • Do not perform any object upload actions in this skill.
  • Especially during verification, use read-only checks only; never upload test files.

Permission Failure Handling (MUST)

When any command fails due to IAM permission errors:

1. Read references/iam-policies.md. 2. Show the required permission list and policy JSON to the user. 3. Guide the user to create a custom IAM policy and grant it in Huawei Cloud IAM console. 4. Pause execution and wait for user confirmation that permissions were granted.

References

Load references/obs-python-sdk-website.md for SDK method usage for website hosting and custom domain registration (setBucketCustomDomain). Load references/iam-policies.md for required IAM actions and policy JSON. Load references/hcloud-dns-obs-website.md for step-by-step DNS CNAME configuration for custom domains via Huawei Cloud DNS (hcloud CLI), including zone lookup, record creation, and verification.

Known Pitfall: The setBucketWebsite API in esdk-obs-python >= 3.x uses WebsiteConfiguration model objects, not keyword arguments like indexDocumentSuffix. Always import WebsiteConfiguration, IndexDocument, and ErrorDocument and construct them properly.

Scripts

Use scripts only for repeatable checks and verification. Keep command output human-readable and focused on success/failure.

  • scripts/set_obs_website_sdk.py <bucket_name> <endpoint> [--index-document <name>] [--error-document <name>] [--custom-domain <domain>] applies static website hosting settings through the OBS SDK and reads credentials from CLI args, env vars, or ~/.obsutilconfig.
  • scripts/verify_obs_website.py <site_url> [--index-document <name>] [--json] [--bucket-name <name> --expected-region <region>] verifies endpoint DNS/HTTP behavior and can also perform a read-only bucket existence + region check (headBucket + getBucketLocation). It auto-builds OBS API endpoint as https://obs.<region>.myhuaweicloud.com. It prints structured sections (Input summary, Actions performed, Verification results, Remediation steps) so agent responses can directly reuse them.

Validation Rules

  • The website endpoint should follow BucketName.obs-website.Endpoint.
  • Public read must be enabled for website files, or the site will return access errors.
  • A custom domain should point to the OBS website endpoint with a CNAME record.
  • Treat DNS propagation as eventual; the setup is not complete until name resolution works.
  • Root path verification and one missing-path check are mandatory.

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.