Quickstart with Our Gateway
Start Quickly with Cloud Storage
5
Run storage snippets (reviewed)
pip install boto3# flashgate_s3_config.py
import os
import boto3
from botocore.client import Config
FLASHGATE_S3_ENDPOINT = os.environ["FLASHGATE_S3_ENDPOINT"]
FLASHGATE_S3_KEY_ID = os.environ["FLASHGATE_S3_KEY_ID"]
FLASHGATE_S3_SECRET = os.environ["FLASHGATE_S3_SECRET"]
session = boto3.session.Session(
aws_access_key_id=FLASHGATE_S3_KEY_ID,
aws_secret_access_key=FLASHGATE_S3_SECRET,
)
s3_client = session.client(
service_name="s3",
endpoint_url=FLASHGATE_S3_ENDPOINT,
config=Config(signature_version="s3v4"),
)# list_buckets.py
from flashgate_s3_config import s3_client
response = s3_client.list_buckets()
print("Buckets available through Flashgate:")
for bucket in response.get("Buckets", []):
print(f" - {bucket['Name']}")# upload_file.py
import os
from pathlib import Path
from flashgate_s3_config import s3_client
bucket_name = os.environ["FLASHGATE_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 FLASHGATE_S3_ENDPOINT="https://s3-us-east-1.aws.flashback.tech"
export FLASHGATE_S3_KEY_ID="<your-repository-api-key-id>"
export FLASHGATE_S3_SECRET="<your-repository-api-secret>"
export FLASHGATE_BUCKET_NAME="<bucket-attached-to-repository>"
export LOCAL_FILE_PATH="./sample.txt"Start Quickly with AI LLM
Last updated
Was this helpful?