LightYear
/Docs
DocsStorageUse Object Storage with S3-Compatible API

Use Object Storage with S3-Compatible API

Create an object storage bucket and access it using the S3-compatible API with the AWS CLI or SDK.

intermediate
10 min read
LightYear Docs Team
Updated April 24, 2026
object-storages3bucketaws-clicdn

Storage Architecture Diagram

LightYear Object Storage provides S3-compatible storage for files, backups, static assets, and media. It is accessible via the S3 API, making it compatible with any S3 SDK or tool.

Create an Object Storage Bucket

  1. Navigate to Storage → Object Storage.
  2. Click Create Bucket.
  3. Select a region.
  4. Enter a globally unique bucket name (e.g., myapp-assets-2026).
  5. Choose Access Control: Private or Public.
  6. Click Create.

Generate Access Credentials

  1. Navigate to Account → API → Object Storage.
  2. Click Generate Credentials.
  3. Note the Access Key and Secret Key — the secret key is only shown once.

Configure the AWS CLI

>_BASH
$pip install awscli
$aws configure
OUTPUT
AWS Access Key ID [None]: YOUR_ACCESS_KEY
AWS Secret Access Key [None]: YOUR_SECRET_KEY
Default region name [None]: sgp-01
Default output format [None]: json

Set the endpoint URL for LightYear Object Storage:

>_BASH
$export AWS_ENDPOINT_URL=https://sgp-01.objectstorage.lightyear.host

Basic Operations

List Buckets

>_BASH
$aws s3 ls
OUTPUT
2026-04-24 10:00:00 myapp-assets-2026

Upload a File

>_BASH
$aws s3 cp ./image.png s3://myapp-assets-2026/images/image.png

Upload a Directory

>_BASH
$aws s3 sync ./dist/ s3://myapp-assets-2026/static/ --delete

Download a File

>_BASH
$aws s3 cp s3://myapp-assets-2026/images/image.png ./downloaded-image.png

Generate a Pre-signed URL (Time-limited Access)

>_BASH
$aws s3 presign s3://myapp-assets-2026/images/image.png --expires-in 3600

Use with Python (boto3)

PYTHON
import boto3

s3 = boto3.client(
    's3',
    endpoint_url='https://sgp-01.objectstorage.lightyear.host',
    aws_access_key_id='YOUR_ACCESS_KEY',
    aws_secret_access_key='YOUR_SECRET_KEY'
)

# Upload a file
s3.upload_file('local_file.txt', 'myapp-assets-2026', 'remote/path/file.txt')

# Generate a pre-signed URL
url = s3.generate_presigned_url(
    'get_object',
    Params={'Bucket': 'myapp-assets-2026', 'Key': 'remote/path/file.txt'},
    ExpiresIn=3600
)
print(url)

Enable CDN for a Bucket

  1. Navigate to Storage → Object Storage → Your Bucket.
  2. Click Enable CDN.
  3. Your bucket content is now served from edge locations globally.

CDN URLs follow the pattern: https://cdn.lightyear.host/BUCKET_NAME/path/to/file.png

[!TIP] Use CDN for static assets (images, CSS, JS) to reduce latency for global users. CDN bandwidth is charged separately at $0.005/GB.

Was this article helpful?

Your cookie choices for this website

This site uses cookies and related technologies, as described in our privacy policy, for purposes that may include site operation, analytics, and enhanced user experience. You may choose to consent to our use of these technologies, or manage your own preferences. Cookie policy