Quickstart with Our Gateway
Start Quickly with Cloud Storage
5
Run storage snippets (reviewed)
pip install boto3# flashback_s3_config.py
import os
import boto3
from botocore.client import Config
FLASHBACK_S3_ENDPOINT = os.environ["FLASHBACK_S3_ENDPOINT"]
FLASHBACK_S3_KEY_ID = os.environ["FLASHBACK_S3_KEY_ID"]
FLASHBACK_S3_SECRET = os.environ["FLASHBACK_S3_SECRET"]
session = boto3.session.Session(
aws_access_key_id=FLASHBACK_S3_KEY_ID,
aws_secret_access_key=FLASHBACK_S3_SECRET,
)
s3_client = session.client(
service_name="s3",
endpoint_url=FLASHBACK_S3_ENDPOINT,
config=Config(signature_version="s3v4"),
)# list_buckets.py
from flashback_s3_config import s3_client
response = s3_client.list_buckets()
print("Buckets available through Flashback:")
for bucket in response.get("Buckets", []):
print(f" - {bucket['Name']}")# upload_file.py
import os
from pathlib import Path
from flashback_s3_config import s3_client
bucket_name = os.environ["FLASHBACK_BUCKET_NAME"]
file_path = Path(os.environ["LOCAL_FILE_PATH"])
object_key = file_path.name
s3_client.upload_file(
Filename=str(file_path),
Bucket=bucket_name,
Key=object_key,
)
print(f"Uploaded '{object_key}' to bucket '{bucket_name}'.")export FLASHBACK_S3_ENDPOINT="https://s3-us-east-1.aws.flashback.tech"
export FLASHBACK_S3_KEY_ID="<your-repository-api-key-id>"
export FLASHBACK_S3_SECRET="<your-repository-api-secret>"
export FLASHBACK_BUCKET_NAME="<bucket-attached-to-repository>"
export LOCAL_FILE_PATH="./sample.txt"Start Quickly with AI LLM
Last updated
Was this helpful?