### Install Tigris Go SDK Source: https://www.tigrisdata.com/docs/changelog Install the Tigris Go SDK using the go get command. ```go go get github.com/tigrisdata/storage-go@latest ``` -------------------------------- ### Install Tigris Go Storage SDK Source: https://www.tigrisdata.com/docs/objects/bundle Install the Tigris storage Go SDK using the go get command. ```bash go get github.com/tigrisdata/storage-go ``` -------------------------------- ### Install and Run TAG with Native Binary Source: https://www.tigrisdata.com/docs/acceleration-gateway/quickstart Installs TAG using a curl script, sets Tigris credentials, and starts the TAG service. Ensure you have read-only Tigris credentials. ```bash # Download and install TAG curl -sSL https://raw.githubusercontent.com/tigrisdata/tag-deploy/main/native/install.sh | bash # Set your Tigris credentials export AWS_ACCESS_KEY_ID= export AWS_SECRET_ACCESS_KEY= # Start TAG tag --config /etc/tag/config.yaml ``` -------------------------------- ### Example: Get Bucket Details Source: https://www.tigrisdata.com/docs/cli/buckets/get This is an example of how to use the 'tigris buckets get' command to fetch details for a bucket named 'my-bucket'. ```bash tigris buckets get my-bucket ``` -------------------------------- ### Clone the sdxl-in-tigris template Source: https://www.tigrisdata.com/docs/model-storage/skypilot Clone the template repository to get started with the example. ```bash git clone https://github.com/tigrisdata-community/sdxl-in-tigris ``` -------------------------------- ### Install LanceDB with uv Source: https://www.tigrisdata.com/docs/libraries/lancedb Installs LanceDB using uv. ```bash uv pip install lancedb ``` -------------------------------- ### Create Organization Example Source: https://www.tigrisdata.com/docs/cli/organizations/create An example of creating an organization named 'my-org' using the CLI. ```bash tigris orgs create my-org ``` -------------------------------- ### Canonical URI Example (GET with Query Params) Source: https://www.tigrisdata.com/docs/api/extensions/v1/api.yaml Example of a Canonical URI for a GET request with query parameters. ```http https://mgmt.storage.dev/provider/your-provider-id/orgs/?include_inactive=true ``` -------------------------------- ### Install Agent Kit Source: https://www.tigrisdata.com/docs/ai/agent-kit Install the Agent Kit library using npm, pnpm, or yarn. ```bash npm install @tigrisdata/agent-kit ``` ```bash pnpm add @tigrisdata/agent-kit ``` ```bash yarn add @tigrisdata/agent-kit ``` -------------------------------- ### Tigris CLI Object Operations Examples Source: https://www.tigrisdata.com/docs/cli/objects Provides examples for common object operations including listing, getting, uploading, deleting, setting access, and retrieving object information. ```bash tigris objects list my-bucket ``` ```bash tigris objects list-versions my-bucket ``` ```bash tigris objects get my-bucket report.pdf --output ./report.pdf ``` ```bash tigris objects put my-bucket report.pdf ./report.pdf ``` ```bash tigris objects delete my-bucket report.pdf ``` ```bash tigris objects set-access my-bucket report.pdf public ``` ```bash tigris objects info my-bucket report.pdf ``` -------------------------------- ### Install and Run TAG with Docker Source: https://www.tigrisdata.com/docs/acceleration-gateway/quickstart Clones the TAG deployment repository, creates a .env file with Tigris credentials, and starts TAG using Docker Compose. The Docker image runs as a non-root user and persists cache data. ```bash git clone https://github.com/tigrisdata/tag-deploy.git cd tag-deploy # Create docker/.env with credentials cat > docker/.env < 1000000", "auth": { "basic_user": "string", "basic_pass": "string", "token": "string" } }, "lifecycle_rules": { "rules": [ { "id": "string", "enabled": true, "expiration": { "days": 0, "date": "2025-01-01T00:00:00Z" }, "transitions": [ { "days": 0, "date": "2025-06-01T00:00:00Z", "storage_class": "STANDARD" } ], "filter": { "prefix": "string" } } ] } }, "user_role": "Admin", "fork_of": "string", "source_snapshot": "string" } ``` -------------------------------- ### Install Tigris Storage SDK with Yarn Source: https://www.tigrisdata.com/docs/sdks/tigris Install the Tigris Storage SDK package using Yarn. ```bash yarn add @tigrisdata/storage ``` -------------------------------- ### Install AWS .Net SDK Packages Source: https://www.tigrisdata.com/docs/sdks/s3/aws-net-sdk Installs the necessary AWS SDK packages for .NET using the dotnet CLI. ```bash dotnet add package AWSSDK.S3 dotnet add package AWSSDK.SecurityToken dotnet add package AWSSDK.SSO dotnet add package AWSSDK.SSOOIDC ``` -------------------------------- ### Verify TAG Installation Source: https://www.tigrisdata.com/docs/acceleration-gateway/native Check the installed version of the TAG binary after installation. ```bash tag --version ``` -------------------------------- ### Install boto3 Source: https://www.tigrisdata.com/docs/quickstarts/python Install the boto3 library using pip. This is a prerequisite for using Tigris with the standard AWS SDK. ```bash pip install boto3 ``` -------------------------------- ### Full UpdateBucketRequest Example Source: https://www.tigrisdata.com/docs/partner-integrations/api/schemas/updatebucketrequest A complete example of the UpdateBucketRequest schema, showing all configurable fields. ```json { "public": true, "enable_object_acl": true, "enable_public_list_objects": true, "object_notifications": { "enabled": true, "webhook": "https://webhook.example.com/tigris-events", "filter": "size > 1000000", "auth": { "basic_user": "string", "basic_pass": "string", "token": "string" } }, "regions": "string" } ``` -------------------------------- ### BucketWebsiteSettings JSON Example Source: https://www.tigrisdata.com/docs/partner-integrations/api/schemas/bucketwebsitesettings Example of a BucketWebsiteSettings object with a custom domain name. ```json { "domain_name": "images.example.com" } ``` -------------------------------- ### Run the server Source: https://www.tigrisdata.com/docs/libraries/lancedb/docs-search Start the search server using Node.js. ```bash node index.js ``` -------------------------------- ### Install LanceDB Geneva Package Source: https://www.tigrisdata.com/docs/libraries/lancedb Install the necessary Python package for using LanceDB's multimodal lakehouse features. This is the first step to getting started. ```bash pip install geneva ``` -------------------------------- ### Install Tigris JavaScript Storage SDK and Tar Stream Source: https://www.tigrisdata.com/docs/objects/bundle Install the Tigris JavaScript storage SDK and the tar-stream library using npm. ```bash npm install @tigrisdata/storage tar-stream ``` -------------------------------- ### List and Take Snapshots Source: https://www.tigrisdata.com/docs/cli/snapshots Examples of how to list existing snapshots for a bucket and how to take a new snapshot using the Tigris CLI. ```bash tigris snapshots list my-bucket ``` ```bash tigris snapshots take my-bucket ``` -------------------------------- ### Example Input Data Format Source: https://www.tigrisdata.com/docs/training/big-data-skypilot Illustrates the structure of an input example containing a list of conversation turns, each with a role and content. ```json { "conversations": [ { "role": "user", "content": "Hello, computer, how many r's are in the word 'strawberry'?" }, { "role": "assistant", "content": "There are three r's in the word 'strawberry'." } ] } ``` -------------------------------- ### Install and Authenticate Tigris CLI Source: https://www.tigrisdata.com/docs/ai/agent-plugins Install the Tigris CLI globally using npm and authenticate your access to Tigris services. ```bash npm install -g @tigrisdata/cli tigris login ``` -------------------------------- ### Example: List Policies for an Access Key Source: https://www.tigrisdata.com/docs/cli/access-keys/list-policies Demonstrates how to list all IAM policies for a given access key ID. ```bash tigris access-keys list-policies tid_AaBbCcDdEeFf ``` -------------------------------- ### Handle Object Get Response Source: https://www.tigrisdata.com/docs/sdks/tigris/using-sdk Example demonstrating how to handle the response from a 'get' operation, checking for errors and accessing object metadata. ```javascript const objectResult = await get("photo.jpg", "file"); if (objectResult.error) { console.error("Error downloading object:", objectResult.error); } else { console.log("Object name:", objectResult.data?.name); console.log("Object size:", objectResult.data?.size); console.log("Object type:", objectResult.data?.type); } ``` -------------------------------- ### Server Configuration Example Source: https://www.tigrisdata.com/docs/acceleration-gateway/configuration Example of server configuration settings in YAML format, including HTTP port, bind IP, pprof enablement, and TLS settings. ```yaml # Server configuration server: # HTTP port for the S3 API # Default: 8080 http_port: 8080 # IP address to bind to # Default: "0.0.0.0" (all interfaces) bind_ip: "0.0.0.0" # Enable pprof profiling endpoints # Default: false (disabled for security) pprof_enabled: false # Path to TLS certificate file (PEM format) # When both tls_cert_file and tls_key_file are set, TAG serves HTTPS # Default: "" (TLS disabled, serves HTTP) tls_cert_file: "" # Path to TLS private key file (PEM format) # Must be set together with tls_cert_file # Default: "" (TLS disabled, serves HTTP) tls_key_file: "" ``` -------------------------------- ### Activate virtual environment and install dependencies Source: https://www.tigrisdata.com/docs/model-storage/skypilot Activate the pipenv virtual environment and install project dependencies using the requirements.txt file. ```bash pipenv shell --python 3.11 pip install -r requirements.txt ``` -------------------------------- ### Install DuckLake Extension Source: https://www.tigrisdata.com/docs/quickstarts/ducklake Install and load the DuckLake extension within the DuckDB shell. This is a one-time setup per DuckDB instance. ```sql INSTALL ducklake; LOAD ducklake; ``` -------------------------------- ### Clone the repository Source: https://www.tigrisdata.com/docs/libraries/lancedb/docs-search Clone the example application repository to your local machine. ```bash git clone https://github.com/tigrisdata-community/docs-search-example cd docs-search-example ``` -------------------------------- ### Set CORS: Allow all origins for GET and HEAD Source: https://www.tigrisdata.com/docs/cli/buckets/set-cors Configures a bucket to allow all origins for GET and HEAD HTTP methods. This is a common starting point for public read access. ```bash # Allow all origins for GET and HEAD tigris buckets set-cors my-bucket --origins '*' --methods GET,HEAD ``` -------------------------------- ### Create Snapshot and List Snapshots (Default Bucket) Source: https://www.tigrisdata.com/docs/sdks/tigris/snapshots-and-forks Demonstrates creating a snapshot and listing snapshots without explicitly providing a bucket name, relying on environment configuration. Imports `createBucketSnapshot` and `listBucketSnapshots`. ```javascript import { createBucketSnapshot, listBucketSnapshots } from "@tigrisdata/storage"; await createBucketSnapshot({ name: "pre-finetune", // optional name for the snapshot }); await listBucketSnapshots(); ``` -------------------------------- ### Get Object with Specific Bucket Override Source: https://www.tigrisdata.com/docs/sdks/tigris/using-sdk Example of retrieving an object while overriding only the bucket name in the configuration. ```javascript const result = await get("object.txt", "string", { config: { bucket: "different-bucket", }, }); ``` -------------------------------- ### Manage Snapshots and Forks with Tigris Go SDK Source: https://www.tigrisdata.com/docs/quickstarts/go Demonstrates creating snapshot-enabled buckets, taking snapshots, listing snapshots, and creating forks (copy-on-write clones) using the Tigris Go SDK. ```go import storage "github.com/tigrisdata/storage-go" // Create a snapshot-enabled bucket err := client.CreateSnapshotBucket(ctx, "my-snapshots") // Take a snapshot snapshot, err := client.CreateSnapshot(ctx, "my-snapshots") fmt.Printf("Snapshot: %s\n", snapshot) // List snapshots snapshots, err := client.ListSnapshots(ctx, "my-snapshots") // Fork a bucket — instant copy-on-write clone err = client.CreateFork(ctx, "my-snapshots", "experiment-1") ``` -------------------------------- ### ChargeTier Schema Example Source: https://www.tigrisdata.com/docs/partner-integrations/api/schemas/chargetier This JSON object represents the structure of a ChargeTier, including its name, quantity, starting point, price, and subtotal. ```json { "name": "string", "quantity": 0, "starting_after": 0, "price": 0, "subtotal": 0 } ``` -------------------------------- ### UsageValue JSON Example Source: https://www.tigrisdata.com/docs/partner-integrations/api/schemas/usagevalue This JSON object represents a usage record, specifying the start and end times of the period and the associated usage value. ```json { "starting_on": "2021-09-01T01:00:00Z", "ending_before": "2021-09-01T02:00:00Z", "value": 0 } ``` -------------------------------- ### Initialize Tigris MCP Server Source: https://www.tigrisdata.com/docs/mcp/local Automates the setup process for the Tigris MCP Server. Run this script for Claude Desktop, Cursor AI, and VS Code. ```bash npx -y @tigrisdata/tigris-mcp-server init ``` -------------------------------- ### Basic Object Operations with Tigris JS/TS SDK Source: https://www.tigrisdata.com/docs/changelog Example of putting and getting an object using the Tigris Storage SDK for JavaScript and TypeScript. ```typescript import { put, get } from "@tigrisdata/storage"; await put("object.txt", "Hello, world!"); const file = await get("object.txt", "string"); ``` -------------------------------- ### Use Tigris Storage SDK in TypeScript Source: https://www.tigrisdata.com/docs Example of using the Tigris storage SDK in TypeScript to get and put objects. Ensure you have imported the necessary functions. ```typescript import { get, put } from '@tigrisdata/storage'; await get('my-file.jpg', 'file'); await put('object.txt', 'Hello, World!'); ``` -------------------------------- ### Create Bucket using Fly Source: https://www.tigrisdata.com/docs/objects/access-objects-via-cookies Command to create a bucket named 'images.example.com' using the Fly CLI. ```bash fly storage create ``` -------------------------------- ### LifecycleRuleFilter Schema Example Source: https://www.tigrisdata.com/docs/partner-integrations/api/schemas/lifecyclerulefilter This schema defines the structure for filtering lifecycle rules by object key prefix. Use this to apply rules to objects starting with a specific string. ```json { "prefix": "string" } ``` -------------------------------- ### Image Transformation for PyTorch Training Source: https://www.tigrisdata.com/docs/quickstarts/pytorch Example setup for defining a transform function to convert raw S3 object data (like images) into PyTorch tensors for model training. ```python from PIL import Image import io import torchvision.transforms as T ``` -------------------------------- ### Full AWS Go SDK v2 Example with Tigris Source: https://www.tigrisdata.com/docs/sdks/s3/aws-go-sdk A complete Go program demonstrating S3 operations using the AWS Go SDK v2 configured for Tigris. It includes listing buckets, uploading a file, listing objects, and downloading a file. Ensure you have the AWS SDK v2 imported and load default configurations. ```go package main import ( "context" "flag" "fmt" "log" "os" "time" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/service/s3" ) func main() { flag.Parse() if flag.NArg() != 1 { log.Fatalf("usage: %s ", flag.Arg(0)) } bucketName := flag.Arg(0) ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() sdkConfig, err := config.LoadDefaultConfig(ctx) if err != nil { log.Printf("Couldn't load default configuration. Here's why: %v", err) return } // Create S3 service client svc := s3.NewFromConfig(sdkConfig, func(o *s3.Options) { o.BaseEndpoint = aws.String("https://t3.storage.dev") o.Region = "auto" o.UsePathStyle = false o.DisableLogOutputChecksumValidationSkipped = true }) // List buckets result, err := svc.ListBuckets(ctx, &s3.ListBucketsInput{}) if err != nil { log.Printf("Unable to list buckets. Here's why: %v", err) return } fmt.Println("Buckets:") for _, b := range result.Buckets { fmt.Printf("* %s created on %s\n", aws.ToString(b.Name), aws.ToTime(b.CreationDate)) } // Upload file fmt.Println("Upload file:") os.WriteFile("bar.txt", []byte("Hello, World!"), 0644) file, err := os.Open("bar.txt") if err != nil { log.Printf("Couldn't open file to upload. Here's why: %v\n", err) return } defer file.Close() _, err = svc.PutObject(ctx, &s3.PutObjectInput{ Bucket: aws.String(bucketName), Key: aws.String("bar.txt"), Body: file, }) if err != nil { log.Printf("Couldn't upload file. Here's why: %v\n", err) return } fmt.Println("File uploaded.") // List objects fmt.Println("List objects:") resp, err := svc.ListObjectsV2(ctx, &s3.ListObjectsV2Input{ Bucket: aws.String(bucketName), }) if err != nil { log.Printf("Unable to list objects. Here's why: %v", err) return } if len(resp.Contents) == 0 { log.Printf("No objects found in bucket: %s", bucketName) return } fmt.Println("Objects:") for _, obj := range resp.Contents { fmt.Printf("* %s\n", aws.ToString(obj.Key)) } // Download file fmt.Println("Download file:") file, err = os.Create("bar.txt") if err != nil { log.Printf("Couldn't create file to download. Here's why: %v", err) return } defer file.Close() _, err = svc.GetObject(ctx, &s3.GetObjectInput{ Bucket: aws.String(bucketName), Key: aws.String("bar.txt"), }) if err != nil { log.Printf("Couldn't download file. Here's why: %v", err) return } fmt.Println("File downloaded.") } ``` -------------------------------- ### Create Bucket Snapshot in Python Source: https://www.tigrisdata.com/docs/buckets/snapshots-and-forks This Python example uses boto3 and tigris-boto3-ext to create a bucket and then create snapshots with optional names. ```python pip install tigris-boto3-ext ``` ```Python import boto3 from tigris_boto3_ext import ( create_snapshot_bucket, create_snapshot, get_snapshot_version, ) # Initialize boto3 S3 client s3_client = boto3.client( 's3', endpoint_url='https://t3.storage.dev', # Tigris endpoint aws_access_key_id='your-access-key', aws_secret_access_key='your-secret-key', ) # Create snapshot-enabled bucket create_snapshot_bucket(s3_client, 'bucket-with-snapshots') # Create snapshots result = create_snapshot(s3_client, 'bucket-with-snapshots', snapshot_name='test-snapshot') version = get_snapshot_version(result) ``` -------------------------------- ### Start Cluster Mode TAG Deployment Source: https://www.tigrisdata.com/docs/acceleration-gateway/docker Deploy TAG in cluster mode using a specific Docker Compose file for multi-node setups. This enables distributed caching and high availability. ```bash cd docker docker compose -f docker-compose-cluster.yml up -d ``` -------------------------------- ### List Buckets, Objects, and Upload Files with AWS SDK v3 Source: https://www.tigrisdata.com/docs/sdks/s3/aws-js-sdk Example demonstrating how to list all S3 buckets, list objects within a bucket, and upload a file from the filesystem using the AWS Node.js SDK v3. ```javascript import { S3Client, paginateListBuckets, paginateListObjectsV2, PutObjectCommand, } from "@aws-sdk/client-s3"; import { readFile } from "node:fs/promises"; // listBuckets returns a list of all S3 buckets in the account with // metadata such as creation date and owner. export const listBuckets = async (S3) => { const buckets = []; for await (const page of paginateListBuckets({ client: S3 }, {})) { if (page.Buckets) { buckets.push(...page.Buckets); } } return buckets; }; // listObjects returns a list of all objects in a bucket. This only returns // the keys of the objects, not the objects themselves. Customize the // objects.push line to return more metadata about the objects. export const listObjects = async (S3, bucketName) => { const paginator = paginateListObjectsV2( { client: S3, pageSize: 100 }, { Bucket: bucketName }, ); const objects = []; for await (const page of paginator) { if (page.Contents) { objects.push(page.Contents.map((o) => o.Key)); // only get object keys } } return objects; }; // uploadObjectFromFS uploads a file from the local filesystem to an S3 bucket. // This does not handle large files or multipart uploads. export const uploadObjectFromFS = async (S3, bucket, key, filePath) => { const command = new PutObjectCommand({ Bucket: bucket, Key: key, Body: await readFile(filePath), }); const response = await S3.send(command); return response; }; const S3 = new S3Client({ region: "auto", s3ForcePathStyle: false, }); console.log("List buckets"); const buckets = await listBuckets(S3); console.log("Buckets:", buckets); console.log("List objects in a bucket"); const objects = await listObjects(S3, "tigris-example"); objects.forEach((objects, pageNum) => { console.log(`Page ${pageNum + 1}:`, objects); }); console.log("Upload an object"); const response = await uploadObjectFromFS( S3, "tigris-example", "examples/js/getting-started.js", "getting-started.js", ); console.log("Upload response:", response); ``` -------------------------------- ### Select Login Method (Default) Source: https://www.tigrisdata.com/docs/cli/login/select Run this command to initiate the login process and select your authentication method. This is the default behavior when `tigris login` is run without specific subcommands. ```bash tigris login select ``` -------------------------------- ### Interact with Deployed Model via Curl Source: https://www.tigrisdata.com/docs/training/big-data-skypilot This example shows how to send a POST request to the deployed model's API endpoint using curl to get a chat completion. Ensure the IP address and port match your deployment. ```bash curl 3.84.15.251:30001/v1/chat/completions \ -X POST \ -d '{"model": "/home/ubuntu/tigris/done/Qwen/Qwen2.5-0.5B/mlabonne/FineTome-100k/fused", "messages": [{"role": "user", "content": "Who are you?"}]}' \ -H 'Content-Type: application/json' ``` -------------------------------- ### Basic S3 Operations with AWS PHP SDK Source: https://www.tigrisdata.com/docs/sdks/s3/aws-php-sdk This snippet demonstrates core S3 operations including listing buckets, putting an object, getting an object, and listing objects within a bucket. Ensure the AWS SDK is installed via Composer and credentials are set up. ```php 'auto', 'endpoint' => 'https://t3.storage.dev', 'version' => 'latest', ]); # Lists all of your buckets print("\nMy buckets now are:\n"); $promise = $s3->listBucketsAsync(); $result = $promise->wait(); foreach ($result['Buckets'] as $bucket) { print("\n"); print($bucket['Name']); } # Put an object into the bucket $file_name = "bar-file-" . uniqid(); try { $s3->putObject([ 'Bucket' => $bucket_name, 'Key' => $file_name, 'SourceFile' => 'bar.txt' ]); echo "Uploaded $file_name to $bucket_name.\n"; } catch (Exception $exception) { echo "Failed to upload $file_name with error: " . $exception->getMessage(); exit("Please fix error with file upload before continuing."); } try { $file = $s3->getObject([ 'Bucket' => $bucket_name, 'Key' => $file_name, ]); $body = $file->get('Body'); $body->rewind(); echo "Downloaded the file and it begins with: {" . $body->read(26) . "}.\n"; } catch (Exception $exception) { echo "Failed to download $file_name from $bucket_name with error: " . $exception->getMessage(); exit("Please fix error with file downloading before continuing."); } try { $contents = $s3->listObjects([ 'Bucket' => $bucket_name, ]); echo "The contents of your bucket are: \n"; foreach ($contents['Contents'] as $content) { echo $content['Key'] . "\n"; } } catch (Exception $exception) { echo "Failed to list objects in $bucket_name with error: " . $exception->getMessage(); exit("Please fix error with listing objects before continuing."); } ?> ``` -------------------------------- ### Generate Presigned URLs for S3 Operations Source: https://www.tigrisdata.com/docs/sdks/s3/aws-go-sdk This Go program demonstrates how to create presigned URLs for PUT, GET, and DELETE operations on S3 objects using the AWS Go SDK. It includes client setup, presigning requests, and handling responses. Ensure path-style requests are disabled in your S3 SDK configuration for compatibility. ```go package main import ( "context" "flag" "fmt" "log" "os" "strings" "time" "github.com/aws/aws-sdk-go-v2/aws" v4 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/service/s3" ) // Client encapsulates the S3 SDK presign client and provides methods to presign requests. type Client struct { PresignClient *s3.PresignClient } // GetObject makes a presigned request that can be used to get an object from a bucket. func (p *Client) GetObject( ctx context.Context, bucket string, key string, expiry time.Duration, ) (*v4.PresignedHTTPRequest, error) { request, err := p.PresignClient.PresignGetObject(ctx, &s3.GetObjectInput{ Bucket: aws.String(bucket), Key: aws.String(key), }, func(opts *s3.PresignOptions) { opts.Expires = expiry }) if err != nil { log.Printf("Couldn't get a presigned request to get %v:%v. Here's why: %v\n", bucket, key, err) } return request, err } // PutObject makes a presigned request that can be used to put an object in a bucket. func (p *Client) PutObject( ctx context.Context, bucket string, object string, expiry time.Duration, ) (*v4.PresignedHTTPRequest, error) { request, err := p.PresignClient.PresignPutObject(ctx, &s3.PutObjectInput{ Bucket: aws.String(bucket), Key: aws.String(object), }, func(opts *s3.PresignOptions) { opts.Expires = expiry }) if err != nil { log.Printf("Couldn't get a presigned request to put %v:%v. Here's why: %v\n", bucket, object, err) } return request, err } // DeleteObject makes a presigned request that can be used to delete an object from a bucket. func (p *Client) DeleteObject(ctx context.Context, bucket string, object string, expiry time.Duration) (*v4.PresignedHTTPRequest, error) { request, err := p.PresignClient.PresignDeleteObject(ctx, &s3.DeleteObjectInput{ Bucket: aws.String(bucket), Key: aws.String(object), }, func(opts *s3.PresignOptions) { opts.Expires = expiry }) if err != nil { log.Printf("Couldn't get a presigned request to delete object %v. Here's why: %v\n", object, err) } return request, err } func main() { flag.Parse() if flag.NArg() != 1 { log.Fatalf("usage: %s ", os.Args[0]) } bucketName := flag.Arg(0) ctx, cancel := context.WithCancel(context.Background()) defer cancel() sdkConfig, err := config.LoadDefaultConfig(ctx) if err != nil { log.Printf("Couldn't load default configuration. Here's why: %v\n", err) return } // Create S3 service client svc := s3.NewFromConfig(sdkConfig, func(o *s3.Options) { o.BaseEndpoint = aws.String("https://t3.storage.dev") o.Region = "auto" o.UsePathStyle = false }) // Presigning a request ps := s3.NewPresignClient(svc) presigner := &Client{PresignClient: ps} // Presigned URL to upload an object to the bucket presignedPutReq, err := presigner.PutObject(ctx, bucketName, "bar.txt", 60*time.Minute) if err != nil { log.Printf("Couldn't get a presigned request to put bar.txt. Here's why: %v\n", err) } else { fmt.Printf("Presigned URL for PUT: %s\n", presignedPutReq.URL) } // Presigned URL to download an object from the bucket presignedGetReq, err := presigner.GetObject(ctx, bucketName, "bar.txt", 60*time.Minute) if err != nil { log.Printf("Couldn't get a presigned request to get bar.txt. Here's why: %v\n", err) return } fmt.Printf("Presigned URL for GET: %s\n", presignedGetReq.URL) // Replace the bucket host with your custom domain before sharing brandedURL := strings.ReplaceAll(presignedGetReq.URL, bucketName+".t3.storage.dev", "your-domain.example.com") fmt.Printf("Presigned URL for GET (custom domain): %s\n", brandedURL) // Presigned URL to delete an object from the bucket presignedDeleteReq, err := presigner.DeleteObject(ctx, bucketName, "bar.txt", 60*time.Minute) if err != nil { log.Printf("Couldn't get a presigned request to delete bar.txt. Here's why: %v\n", err) } else { fmt.Printf("Presigned URL for DELETE: %s\n", presignedDeleteReq.URL) } } ``` -------------------------------- ### Create Test HTML File Source: https://www.tigrisdata.com/docs/quickstarts/kubernetes Create an index.html file to test volume mounting. This file will be served by nginx. ```html Test!

Test!

If you see this, then csi-s3 works!

``` -------------------------------- ### Create Tigris Go SDK Client Source: https://www.tigrisdata.com/docs/quickstarts/go Initialize a Tigris client using the Tigris Go SDK. The SDK automatically reads credentials from environment variables. ```go package main import ( "context" "log" storage "github.com/tigrisdata/storage-go" ) func main() { ctx := context.Background() client, err := storage.New(ctx) if err != nil { log.Fatal(err) } } ``` -------------------------------- ### Install TigrisFS on Debian Linux Source: https://www.tigrisdata.com/docs/training/tigrisfs Download and install the TigrisFS Debian package. Ensure FUSE utilities are installed beforehand. ```bash wget https://github.com/tigrisdata/tigrisfs/releases/download/v1.2.1/tigrisfs_1.2.1_linux_amd64.deb dpkg -i tigrisfs_1.2.1_linux_amd64.deb ``` -------------------------------- ### Bundle keys from a file Source: https://www.tigrisdata.com/docs/cli/bundle This example shows how to bundle objects into a tar archive by reading the list of keys from a local file. This is useful for managing large numbers of keys. ```bash tigris bundle my-bucket --keys keys.txt --output archive.tar ``` -------------------------------- ### Configure Tigris Go SDK Client with Options Source: https://www.tigrisdata.com/docs/quickstarts/go Initialize a Tigris client with explicit endpoint and access keypair options, overriding environment variables if necessary. ```go client, err := storage.New(ctx, storage.WithGlobalEndpoint(), storage.WithAccessKeypair("tid_your_access_key", "tsec_your_secret_key"), ) ``` -------------------------------- ### Install s3torchconnector Source: https://www.tigrisdata.com/docs/quickstarts/pytorch Install the s3torchconnector package using pip. Consult an expert if you are unsure about Python package installation in your environment. ```bash pip install s3torchconnector ``` -------------------------------- ### List Snapshots for a Bucket (Python) Source: https://www.tigrisdata.com/docs/buckets/snapshots-and-forks This example demonstrates listing snapshots for a bucket using the Tigris extension for boto3 in Python. It shows initialization of the S3 client, creating a snapshot-enabled bucket, and then listing snapshots using both a context manager and a helper function. ```python pip install tigris-boto3-ext ``` ```python import boto3 from tigris_boto3_ext import ( TigrisSnapshot, create_snapshot_bucket, list_snapshots, ) # Initialize boto3 S3 client s3_client = boto3.client( 's3', endpoint_url='https://t3.storage.dev', # Tigris endpoint aws_access_key_id='your-access-key', aws_secret_access_key='your-secret-key', ) # Create snapshot-enabled bucket create_snapshot_bucket(s3_client, 'bucket-with-snapshots') # List snapshots for a bucket using context manager pattern with TigrisSnapshot(s3_client, 'bucket-with-snapshots'): snapshots = s3_client.list_buckets() # Or, list snapshots via the helper function snapshots = list_snapshots(s3_client, 'bucket-with-snapshots') ``` -------------------------------- ### Install Python Dependencies for Databricks Source: https://www.tigrisdata.com/docs/libraries/databricks Install the required Python packages for interacting with Tigris and handling data. Restart the kernel after installation. ```python pip install boto3 pandas pyarrow s3fs ``` ```python %restart_python ``` -------------------------------- ### GetAccessKeyResponse Example Source: https://www.tigrisdata.com/docs/partner-integrations/api/schemas/getaccesskeyresponse An example of the GetAccessKeyResponse object structure. ```json { "id": "string", "name": "string", "status": "Active", "buckets_roles": [ { "bucket_name": "string", "role": "ReadOnly" } ], "attached_policies": [ "string" ] } ``` -------------------------------- ### Install SkyPilot with AWS and Kubernetes Adaptors Source: https://www.tigrisdata.com/docs/quickstarts/skypilot Install SkyPilot with specific cloud provider adaptors using pip. This command installs adaptors for AWS and Kubernetes. ```bash pip install "skypilot[aws]" pip install "skypilot[kubernetes]" ``` -------------------------------- ### Python SDK for Snapshot Operations Source: https://www.tigrisdata.com/docs/buckets/snapshots-and-forks This example demonstrates initializing the Tigris-extended boto3 client, creating a snapshot-enabled bucket, creating a snapshot, and then retrieving objects from that snapshot using helper functions or a context manager. ```python pip install tigris-boto3-ext ``` ```Python import boto3 from tigris_boto3_ext import ( TigrisSnapshot, create_snapshot_bucket, create_snapshot, get_object_from_snapshot, get_snapshot_version, head_object_from_snapshot, list_objects_from_snapshot, ) # Initialize boto3 S3 client s3_client = boto3.client( 's3', endpoint_url='https://t3.storage.dev', # Tigris endpoint aws_access_key_id='your-access-key', aws_secret_access_key='your-secret-key', ) # First, ensure bucket has snapshots enabled create_snapshot_bucket(s3_client, 'my-bucket') s3_client.put_object(Bucket='my-bucket', Key='file.txt', Body=b'data') response = create_snapshot( s3_client, 'my-bucket', snapshot_name='daily-backup-2024-01-01' ) snapshot_version = get_snapshot_version(response) print(f"Snapshot version: {snapshot_version}") # Read objects from a specific snapshot using context manager pattern with TigrisSnapshot(s3_client, 'my-bucket', snapshot_version=snapshot_version): obj = s3_client.get_object(Bucket='my-bucket', Key='file.txt') objects = s3_client.list_objects_v2(Bucket='my-bucket') # Or, use a helper function to access snapshot data obj = get_object_from_snapshot(s3_client, 'my-bucket', 'file.txt', snapshot_version) objects = list_objects_from_snapshot(s3_client, 'my-bucket', snapshot_version) metadata = head_object_from_snapshot(s3_client, 'my-bucket', 'file.txt', snapshot_version) ``` -------------------------------- ### Ephemeral Evaluation Sandboxes Source: https://www.tigrisdata.com/docs/use-cases/agent-sandboxes This example demonstrates setting up ephemeral sandboxes for evaluation and benchmarking. It involves forking a dataset, running an evaluation script against the fork, and then cleaning up the fork. This ensures the base dataset remains unmodified for deterministic re-runs. ```bash # Fork for eval tigris buckets create eval-run-20240315 --fork-of eval-dataset # Run evaluation python run_eval.py --bucket eval-run-20240315 # Clean up tigris buckets delete eval-run-20240315 ``` -------------------------------- ### Install LanceDB with pip Source: https://www.tigrisdata.com/docs/libraries/lancedb Installs LanceDB using pip. ```bash pip install lancedb ``` -------------------------------- ### Start rclone Configuration Source: https://www.tigrisdata.com/docs/quickstarts/rclone Initiate the rclone configuration process in your terminal. ```bash $ rclone config o remotes found, make a new one? n) New remote s) Set configuration password q) Quit config ``` -------------------------------- ### AccessKeyInfo Schema Example Source: https://www.tigrisdata.com/docs/partner-integrations/api/schemas/accesskeyinfo An example of the AccessKeyInfo schema structure. ```json { "id": "string", "name": "string", "status": "Active", "buckets_roles": [ { "bucket_name": "string", "role": "ReadOnly" } ] } ``` -------------------------------- ### Create a Bucket with Snapshots Enabled Source: https://www.tigrisdata.com/docs/sdks/tigris/snapshots-and-forks Use `createBucket` to initialize a new bucket with snapshot functionality enabled. Check the result for any errors during creation. ```javascript import { createBucket } from "@tigrisdata/storage"; const result = await createBucket("llm-base", { enableSnapshot: true, }); if (result.error) { console.error("error creating bucket", result.error); } else { console.log("bucket created with snapshots enabled"); } ``` -------------------------------- ### Start AutoMQ Cluster Source: https://www.tigrisdata.com/docs/quickstarts/automq Use Docker Compose to start the AutoMQ cluster in detached mode. Monitor the logs to ensure the cluster connects to Tigris and starts successfully. ```bash docker-compose up -d ``` ```bash docker-compose logs -f ``` -------------------------------- ### Start TigrisFS systemd service (current user) Source: https://www.tigrisdata.com/docs/training/tigrisfs Start the TigrisFS systemd service for the current user to mount a bucket. The bucket will be mounted at `$HOME/mnt/tigrisfs/`. ```bash systemctl --user start tigrisfs@ ``` -------------------------------- ### Example: Select Organization Source: https://www.tigrisdata.com/docs/cli/organizations/select Demonstrates how to select a specific organization named 'my-org' as the active organization using the Tigris CLI. ```bash tigris orgs select my-org ``` -------------------------------- ### Get Presigned URL for GET Operation Source: https://www.tigrisdata.com/docs/sdks/tigris/using-sdk Generate a presigned URL for retrieving an object using the `getPresignedUrl` function. Specify 'get' as the operation. Handle potential errors. ```typescript const result = await getPresignedUrl("object.txt", { operation: "get" }); if (result.error) { console.error("Error getting presigned URL:", result.error); } else { console.log("Presigned URL:", result.data.url); } ``` -------------------------------- ### Start TigrisFS systemd service (root) Source: https://www.tigrisdata.com/docs/training/tigrisfs Start the TigrisFS systemd service as root to mount a bucket. The bucket will be mounted at `/mnt/tigrisfs/`. ```bash systemctl start tigrisfs@ ``` -------------------------------- ### Install NPM dependencies Source: https://www.tigrisdata.com/docs/libraries/lancedb/docs-search Install all required NPM dependencies for the project. ```bash npm ci ``` -------------------------------- ### Install Agent Shell with Yarn Source: https://www.tigrisdata.com/docs/ai/agent-shell Install the agent-shell package using Yarn. ```bash yarn add @tigrisdata/agent-shell ``` -------------------------------- ### Install Agent Shell with NPM Source: https://www.tigrisdata.com/docs/ai/agent-shell Install the agent-shell package using NPM. ```bash npm install @tigrisdata/agent-shell ``` -------------------------------- ### Install and Run TAG with Kubernetes Source: https://www.tigrisdata.com/docs/acceleration-gateway/quickstart Clones the TAG deployment repository, creates a Kubernetes namespace and secret for credentials, and applies the base Kubernetes configuration. This deploys a 3-replica StatefulSet with caching and a LoadBalancer service. ```bash git clone https://github.com/tigrisdata/tag-deploy.git cd tag-deploy kubectl create namespace tag kubectl create secret generic tag-credentials \ --namespace tag \ --from-literal=AWS_ACCESS_KEY_ID=your_access_key \ --from-literal=AWS_SECRET_ACCESS_KEY=your_secret_key kubectl apply -k kubernetes/base/ -n tag ``` -------------------------------- ### Migrate Using t3:// Scheme Source: https://www.tigrisdata.com/docs/cli/buckets/migrate Demonstrates using the 't3://' scheme to specify the bucket and prefix for migration. This is an alternative way to reference paths. ```bash # Using the t3:// scheme tigris buckets migrate t3://my-bucket/prefix/ ```