The th command line: every service from your terminal

Deploy Containers and static sites, copy files to Object Storage, connect to databases and caches, and send queue messages from your computer or CI.

Every command, parameter and example is in the th CLI reference.

Install

Shell
# Linux, macOS
curl -fsSL https://raw.githubusercontent.com/mrzack99s/thailandhosting-cli/main/install.sh | sh

# Windows (PowerShell)
irm https://raw.githubusercontent.com/mrzack99s/thailandhosting-cli/main/install.ps1 | iex

The scripts download th from GitHub and check its checksum before installing. With Go 1.23+ you can also run go install github.com/mrzack99s/thailandhosting-cli/cmd/th@latest.

Sign in

th auth login opens the Console. Check that the code matches your terminal, then click Approve. The sign-in lasts 90 days and is listed under Account → Sessions. Pick the Project and region once with th config set project … and th config set region ….

Static Web from a folder

Shell
th static-site deploy docs ./dist       # creates the site on the first deploy
th static-site releases docs
th static-site rollback docs previous
th static-site domains add docs www.example.com

Build your site first (for example npm run build) and deploy the output folder. Each deploy is a release you can roll back to, and counts like a publish in your package.

Object Storage

Shell
th object-storage buckets create my-bucket
th object-storage cp ./report.pdf th://my-bucket/reports/
th object-storage cp -r ./backups th://my-bucket/backups
th object-storage sync ./public th://my-bucket/site --delete
th object-storage ls th://my-bucket/reports/
th object-storage sign th://my-bucket/reports/report.pdf --expires 1h

Database and Cache

Shell
th database create app-db --engine postgres
th database public app-db --enable --allow 203.0.113.7/32   # your IP
th database connect app-db          # opens psql with the credentials
th database credentials app-db
th database backups create app-db
th cache create sessions --engine thcache
th cache connect sessions           # opens redis-cli

The private address works only inside your Project’s VPC; from your computer, turn public access on for your own address first.

Queue Service

Shell
th queue create jobs --visibility-timeout 60s
th queue send jobs '{"order": 1042}'
th queue receive jobs --max 10 --ack
th queue tail jobs                  # receive and acknowledge until Ctrl+C

Containers have their own guide: Deploy from your computer or CI with the th CLI.

In CI

  • Containers and Static Web: create an API key under Integrations → API keys with Containers: deploy (run:write) or Static Web: deploy (static:write) and set it as TH_API_KEY.
  • Object Storage and Queue Service: create an access key on their pages and set TH_OBJECT_STORAGE_KEY_ID / TH_OBJECT_STORAGE_SECRET or TH_QUEUE_KEY_ID / TH_QUEUE_SECRET.

Signed in on your own computer, th makes a short-lived Object Storage or Queue key for you (12 hours, with what your role allows), so you don’t need to create one.

Still stuck? Let our team help

Open a ticket from the Console. Tell us the site or service, what you did and the message on screen. Our reply comes back in the same ticket, so everything stays in one place.