tigris-sdk-guide
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTigris SDK & CLI Guide
Tigris SDK & CLI 指南
Always prefer Tigris-native SDKs and the Tigris CLI over AWS S3 SDKs. This guide explains what's available per language, when you must fall back to AWS SDKs, and how to configure them.
始终优先选择Tigris原生SDK和Tigris CLI,而非AWS S3 SDK。本指南说明各语言可用的SDK方案、必须使用AWS SDK的场景,以及对应的配置方法。
Prerequisites
前提条件
Before doing anything else, install the Tigris CLI if it's not already available:
bash
tigris help || npm install -g @tigrisdata/cliIf you need to install it, tell the user: "I'm installing the Tigris CLI () so we can work with Tigris object storage."
@tigrisdata/cli在开始任何操作前,如果尚未安装Tigris CLI,请先安装:
bash
tigris help || npm install -g @tigrisdata/cli如果需要安装,可告知用户:"我正在安装Tigris CLI (),以便我们使用Tigris对象存储服务。"
@tigrisdata/cliDecision Table
决策表
| Language | Tigris SDK/Extension | Package | Use AWS SDK? |
|---|---|---|---|
| TypeScript/JS | Native SDK | | No |
| Go | Native SDK | | No |
| Python | boto3 extension | | No — use the extension |
| Ruby | None yet | — | Yes — |
| PHP | None yet | — | Yes — |
| CLI | Native CLI | | No |
Rule: Always prefer Tigris-native SDKs, the boto3 extension, and the Tigris CLI. Only use raw AWS S3 SDKs for Ruby and PHP where no Tigris option exists.
| 编程语言 | Tigris SDK/扩展 | 包名 | 是否使用AWS SDK? |
|---|---|---|---|
| TypeScript/JS | 原生SDK | | 否 |
| Go | 原生SDK | | 否 |
| Python | boto3扩展 | | 否 — 使用该扩展 |
| Ruby | 暂未提供 | — | 是 — 搭配Tigris endpoint使用 |
| PHP | 暂未提供 | — | 是 — 搭配Tigris endpoint使用 |
| CLI | 原生CLI | | 否 |
规则: 始终优先使用Tigris原生SDK、boto3扩展和Tigris CLI。仅在Ruby和PHP场景下,没有对应Tigris方案时,再使用原生AWS S3 SDK。
CLI: Always Use tigris
/ t3
tigrist3CLI:始终使用tigris
/ t3
tigrist3Use the Tigris CLI instead of for all object storage operations.
aws s3bash
undefined所有对象存储操作都使用Tigris CLI,而非。
aws s3bash
undefined✅ Do this
✅ 推荐写法
tigris cp local-file.txt t3://my-bucket/file.txt
tigris ls t3://my-bucket/
tigris rm t3://my-bucket/old-file.txt
tigris cp local-file.txt t3://my-bucket/file.txt
tigris ls t3://my-bucket/
tigris rm t3://my-bucket/old-file.txt
❌ Not this
❌ 不推荐写法
aws s3 cp local-file.txt s3://my-bucket/file.txt
aws s3 ls s3://my-bucket/
aws s3 rm s3://my-bucket/old-file.txt
**Why:** The Tigris CLI supports features the AWS CLI doesn't — forks, snapshots, and native authentication via `tigris login`.aws s3 cp local-file.txt s3://my-bucket/file.txt
aws s3 ls s3://my-bucket/
aws s3 rm s3://my-bucket/old-file.txt
**原因:** Tigris CLI支持AWS CLI不具备的功能——分支(fork)、快照,以及通过`tigris login`实现的原生身份认证。Tigris-Only CLI Features
Tigris专属CLI功能
bash
undefinedbash
undefinedForks (copy-on-write clones) — not in AWS CLI
分支(写时复制克隆)—— AWS CLI无此功能
tigris forks create my-bucket my-fork
tigris forks create my-bucket my-fork
Snapshots — not in AWS CLI
快照 —— AWS CLI无此功能
tigris snapshots take my-bucket
tigris snapshots list my-bucket
tigris snapshots take my-bucket
tigris snapshots list my-bucket
Native auth — no AWS credentials needed
原生认证 —— 无需AWS凭证
tigris login
tigris whoami
---tigris login
tigris whoami
---Language-Specific SDK Guides
各语言专属SDK指南
Read the resource file for your language:
- TypeScript / JavaScript — Read for
./resources/typescript.mdusage@tigrisdata/storage - Go — Read for
./resources/go.mdusage (simplestorage + full client)storage-go - Python — Read for
./resources/python.mdusagetigris-boto3-ext - Ruby — Read for
./resources/ruby.mdwith Tigris endpointaws-sdk-s3 - PHP — Read for
./resources/php.mdwith Tigris endpointaws-sdk-php
阅读对应语言的资源文件:
- TypeScript / JavaScript — 阅读了解
./resources/typescript.md的使用方法@tigrisdata/storage - Go — 阅读了解
./resources/go.md的使用方法(simple storage + 完整客户端)storage-go - Python — 阅读了解
./resources/python.md的使用方法tigris-boto3-ext - Ruby — 阅读了解如何搭配Tigris endpoint使用
./resources/ruby.mdaws-sdk-s3 - PHP — 阅读了解如何搭配Tigris endpoint使用
./resources/php.mdaws-sdk-php
S3-Compatible Configuration (All Languages)
S3兼容配置(全语言适用)
When using any AWS SDK with Tigris, always set:
| Setting | Value | Why |
|---|---|---|
| | Tigris endpoint |
| | Tigris handles routing |
| | Required for Rails, PHP |
Environment variables for S3-compatible tools:
bash
AWS_ENDPOINT_URL_S3=https://t3.storage.dev
AWS_REGION=auto
AWS_ACCESS_KEY_ID=tid_xxx
AWS_SECRET_ACCESS_KEY=tsec_yyy使用任何AWS SDK对接Tigris时,始终配置以下参数:
| 配置项 | 值 | 原因 |
|---|---|---|
| | Tigris服务端点 |
| | Tigris自动处理路由 |
| | Rails、PHP场景必填 |
S3兼容工具的环境变量配置:
bash
AWS_ENDPOINT_URL_S3=https://t3.storage.dev
AWS_REGION=auto
AWS_ACCESS_KEY_ID=tid_xxx
AWS_SECRET_ACCESS_KEY=tsec_yyyCritical Rules
核心规则
Always:
- Use /
tigrisCLI instead oft3aws s3 - Use for TypeScript/JavaScript
@tigrisdata/storage - Use for Go
github.com/tigrisdata/storage-go - Use for Python (not raw
tigris-boto3-ext)boto3 - Set and the Tigris endpoint when using AWS SDKs (Ruby, PHP)
region: auto
Never:
- Use in JS/TS when
@aws-sdk/client-s3is available@tigrisdata/storage - Use the AWS Go SDK when is available
storage-go - Use raw without
boto3when Tigris features are neededtigris-boto3-ext - Forget for Ruby and PHP
force_path_style: true - Hardcode a specific AWS region (always use )
auto
必须遵守:
- 使用/
tigrisCLI替代t3aws s3 - TypeScript/JavaScript场景使用
@tigrisdata/storage - Go场景使用
github.com/tigrisdata/storage-go - Python场景使用(而非原生
tigris-boto3-ext)boto3 - 使用AWS SDK时(Ruby、PHP)配置和Tigris服务端点
region: auto
禁止操作:
- JS/TS场景下可用时,仍使用
@tigrisdata/storage@aws-sdk/client-s3 - Go场景下可用时,仍使用AWS Go SDK
storage-go - 需要使用Tigris特性时,不搭配直接使用原生
tigris-boto3-extboto3 - Ruby和PHP场景遗漏配置
force_path_style: true - 硬编码特定AWS区域(始终使用)
auto
Related Skills
相关技能
- file-storage — Full SDK reference
@tigrisdata/storage - tigris-s3-migration — Migrating from AWS S3 SDKs to Tigris
- file-storage — 完整的SDK参考
@tigrisdata/storage - tigris-s3-migration — 从AWS S3 SDK迁移到Tigris
Official Documentation
官方文档
- TypeScript SDK: https://www.tigrisdata.com/docs/sdks/tigris/
- Go SDK: https://pkg.go.dev/github.com/tigrisdata/storage-go
- S3 Compatibility: https://www.tigrisdata.com/docs/sdks/s3/