Docs v3.2
API Reference GitHub ↗

💾Object Storage

CloudNexus Object Storage provides scalable, durable, and S3-compatible storage for your data. Store anything from images and videos to backups and logs with 99.999% durability guarantee.

Overview

Object Storage is a cloud storage architecture that stores data as objects within a flat address space. Each object consists of the data itself, a globally unique identifier, and metadata. It is designed for storing unstructured data at massive scale.

Our object storage is fully S3-compatible, meaning any application or SDK that works with Amazon S3 will work with CloudNexus Object Storage without modification.

â„šī¸
S3 Compatibility

CloudNexus Object Storage implements the full S3 API. Use aws-sdk, boto3, or any S3-compatible tool — just point it to our endpoint URL.

Key Features

  • 99.999% Durability — Data is replicated across multiple facilities and availability zones for maximum durability.
  • Unlimited Scale — No capacity limits. Store bytes or petabytes — it scales automatically.
  • S3-Compatible API — Drop-in replacement for Amazon S3 with full API compatibility.
  • Versioning — Keep multiple versions of objects to protect against accidental deletion or overwrites.
  • Lifecycle Policies — Automatically transition objects to cheaper storage tiers or expire them.
  • CORS Support — Configure Cross-Origin Resource Sharing for browser-based access.
  • Server-Side Encryption — Encrypt objects at rest using AES-256 or customer-provided keys.
  • Pre-signed URLs — Generate temporary access URLs for secure object sharing.

Storage Tiers

Choose the right storage tier based on your access patterns and performance needs.

Tier Use Case Storage Cost Retrieval Cost Min. Retention
Standard Active data, frequent access $0.023 / GB/mo $0.0004 / req None
Infrequent Backups, archives, less-frequent $0.0125 / GB/mo $0.001 / req 30 days
Glacier Long-term archives, compliance $0.004 / GB/mo $0.01 / GB retrieved 90 days
Deep Glacier Regulatory archives, rarely accessed $0.00099 / GB/mo $0.02 / GB retrieved 180 days

Getting Started

Prerequisites

  1. A CloudNexus account with an active project
  2. An Access Key ID and Secret Access Key
  3. Optional: Install the cn-cli tool for command-line management

Creating a Bucket

A bucket is a container for objects stored in CloudNexus Object Storage. Every object must reside in a bucket.

Using the Console

  1. Navigate to Storage → Object Storage in the CloudNexus Console
  2. Click "Create Bucket"
  3. Enter a globally unique bucket name (e.g., my-app-assets)
  4. Select a region for data residency
  5. Choose a default storage tier
  6. Click "Create"

Using the CLI

bash
cn storage bucket create my-app-assets \n  --region us-east-1 \n  --tier standard \n  --versioning true

Using the S3 API

nodejs
const S3Client = require("@aws-sdk/client-s3").S3Client;
const CreateBucketCommand = require("@aws-sdk/client-s3").CreateBucketCommand;

const client = new S3Client({
  endpoint: "https://s3.us-east-1.cloudnexus.io",
  credentials: {
    accessKeyId: process.env.CN_ACCESS_KEY,
    secretAccessKey: process.env.CN_SECRET_KEY,
  },
  region: "us-east-1",
  forcePathStyle: false,
});

await client.send(new CreateBucketCommand({
  Bucket: "my-app-assets",
}));
✅
Bucket Naming Rules

Bucket names must be 3–63 characters, start with a lowercase letter or number, and can contain lowercase letters, numbers, hyphens, and dots. They are globally unique across all CloudNexus accounts.

Common Operations

Uploading Objects

Objects are stored as key-value pairs within a bucket. The key (or path) uniquely identifies the object.

Simple Upload

python
import boto3

s3 = boto3.client(
    "s3",
    endpoint_url="https://s3.us-east-1.cloudnexus.io",
    aws_access_key_id=os.environ["CN_ACCESS_KEY"],
    aws_secret_access_key=os.environ["CN_SECRET_KEY"],
)

# Upload a file
s3.upload_file(
    Filename="/path/to/photo.jpg",
    Bucket="my-app-assets",
    Key="images/photo.jpg",
    ExtraArgs={"ContentType": "image/jpeg"},
)

Multipart Upload (Large Files)

For files larger than 100 MB, use multipart upload to split the file into parts and upload them in parallel.

bash
# Upload large file with multipart
cn storage object upload my-app-assets \n  --key "backups/db-dump-2025-01.sql.gz" \n  --file ./db-dump-2025-01.sql.gz \n  --part-size "50MB"

Downloading Objects

nodejs
const GetObjectCommand = require("@aws-sdk/client-s3").GetObjectCommand;
const fs = require("fs");

const response = await client.send(new GetObjectCommand({
  Bucket: "my-app-assets",
  Key: "images/photo.jpg",
}));

# Stream to file
const writer = fs.createWriteStream("./photo.jpg");
response.Body.pipe(writer);

Listing Objects

bash
# List all objects in a prefix
cn storage object ls my-app-assets \n  --prefix "images/" \n  --max-keys "100"

# List with pagination
cn storage object ls my-app-assets \n  --prefix "logs/" \n  --page-size "500" \n  --all

Pre-signed URLs

Generate temporary URLs that grant time-limited access to private objects without exposing credentials.

python
import boto3

s3_client = boto3.client(
    "s3",
    endpoint_url="https://s3.us-east-1.cloudnexus.io",
    aws_access_key_id="your-access-key",
    aws_secret_access_key="your-secret-key",
)

# Generate a download URL valid for 1 hour
url = s3_client.generate_presigned_url(
    ClientMethod="get_object",
    Params={
        "Bucket": "my-app-assets",
        "Key": "reports/annual-2024.pdf",
    },
    ExpiresIn=3600, # 1 hour in seconds
)
print(url)

Deleting Objects

bash
# Delete a single object
cn storage object delete my-app-assets "images/old-banner.jpg"

# Delete all objects matching a prefix (with confirmation)
cn storage object delete my-app-assets \n  --prefix "temp/" \n  --recursive \n  --confirm
âš ī¸
Warning: Deletion is Permanent

Deleted objects are irretrievable unless versioning is enabled. Always enable versioning on buckets containing critical data before performing bulk deletes.

REST API Reference

All Object Storage operations follow standard S3 API conventions. The base URL for API requests is:

text
https://s3.{region}.cloudnexus.io

# Available regions:
https://s3.us-east-1.cloudnexus.io
https://s3.eu-west-1.cloudnexus.io
https://s3.ap-south-1.cloudnexus.io
https://s3.sa-east-1.cloudnexus.io

Bucket Operations

POST /{bucket-name}

Create a Bucket

Creates a new storage bucket. Bucket names are globally unique and immutable once created.

Parameter Type Required Description
bucket-name string Required Unique name for the bucket (3–63 chars)
x-amz-region string Optional Target region (defaults to us-east-1)
GET /

List All Buckets

Returns a list of all buckets owned by the authenticated account.

DELETE /{bucket-name}

Delete a Bucket

Deletes a bucket. The bucket must be empty before deletion. Returns 409 Conflict if the bucket contains objects.

Object Operations

PUT /{bucket-name}/{key}

Upload an Object

Uploads or overwrites an object in a bucket. Supports optional headers for metadata, content type, and encryption.

Parameter Type Required Description
bucket-name string Required Name of the destination bucket
key string Required Object key (path within the bucket)
Content-Type string Optional MIME type of the object
x-amz-storage-class string Optional Storage tier: STANDARD, INFREQUENT, GLACIER
x-amz-server-side-encryption string Optional Encryption: AES256 or aws:kms
GET /{bucket-name}/{key}

Download an Object

Retrieves an object from a bucket. Supports range requests for partial downloads via the Range header.

GET /{bucket-name}

List Objects in a Bucket

Lists objects in a bucket with optional filtering by prefix, delimiter, and pagination.

Query Param Type Required Description
prefix string Optional Filter objects by key prefix (e.g., images/)
delimiter string Optional Group keys by delimiter (e.g., / for folder-like structure)
max-keys integer Optional Max results per page (default: 1000)
continuation-token string Optional Token for paginated results
DELETE /{bucket-name}/{key}

Delete an Object

Permanently deletes an object. If versioning is enabled, adds a delete marker instead.

Advanced Features

Object Versioning

Enable versioning to retain, retrieve, and restore every version of every object in your bucket.

bash
# Enable versioning on a bucket
cn storage bucket versioning my-app-assets \n  --status Enabled

# List all versions of an object
cn storage object versions my-app-assets "config/settings.json"

# Restore a specific version
cn storage object restore my-app-assets "config/settings.json" \n  --version-id "v3f8a2b1-7d9c-4e11"

Lifecycle Policies

Automate object transitions and expiration using lifecycle configuration rules.

json
{
  "Rules": [
    {
      "ID": "archive-old-logs",
      "Status": "Enabled",
      "Filter": {
        "Prefix": "logs/"
      },
      "Transitions": [
        {
          "Days": 30,
          "StorageClass": "INFREQUENT"
        },
        {
          "Days": 90,
          "StorageClass": "GLACIER"
        }
      ],
      "Expiration": {
        "Days": 365
      }
    }
  ]
}

Server-Side Encryption

Protect your data at rest using server-side encryption. CloudNexus supports two modes:

Method Header Description
AES-256 (SSE-S3) x-amz-server-side-encryption: AES256 CloudNexus-managed keys, no additional cost
KMS (SSE-KMS) x-amz-server-side-encryption: aws:kms Customer-managed keys with CloudNexus KMS, includes audit trail

CORS Configuration

Configure Cross-Origin Resource Sharing for browser-based applications:

json
{
  "CORSRules": [
    {
      "AllowedOrigins": ["https://app.example.com"],
      "AllowedMethods": ["GET", "PUT", "POST", "DELETE"],
      "AllowedHeaders": ["*"],
      "ExposeHeaders": ["ETag", "x-amz-version-id"],
      "MaxAgeSeconds": 3000
    }
  ]
}

SDK Integration

CloudNexus Object Storage works with any S3-compatible SDK. Below are examples for popular languages:

AWS SDK (v3)

npm install @aws-sdk/client-s3
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";

const s3 = new S3Client({
  endpoint: "https://s3.us-east-1.cloudnexus.io",
  credentials: {
    accessKeyId: process.env.CN_ACCESS_KEY,
    secretAccessKey: process.env.CN_SECRET_KEY,
  },
  region: "us-east-1",
});

await s3.send(new PutObjectCommand({
  Bucket: "my-app-assets",
  Key: "uploads/file.pdf",
  Body: fs.readFileSync("./file.pdf"),
  ContentType: "application/pdf",
}));

Boto3 (Python)

pip install boto3
import boto3
from boto3.s3.transfer import S3Transfer

s3 = boto3.resource(
    "s3",
    endpoint_url="https://s3.us-east-1.cloudnexus.io",
    aws_access_key_id="your-access-key",
    aws_secret_access_key="your-secret-key",
)

transfer = S3Transfer(s3)
transfer.upload_file(
    "./large-video.mp4",
    "my-app-assets",
    "videos/tutorial.mp4",
    Callback=lambda bytes: print(f"Uploaded: {bytes} bytes"),
)

AWS CLI

bash
# Sync an entire directory
aws s3 sync ./dist/ s3://my-app-assets/static/ \n  --endpoint https://s3.us-east-1.cloudnexus.io \n  --no-sign-request # if using pre-signed or public bucket

# Copy between buckets
aws s3 cp s3://source-bucket/data.csv \n  s3://my-app-assets/import/data.csv \n  --endpoint https://s3.us-east-1.cloudnexus.io

Best Practices

💡
Design Tips for Production

Follow these best practices to get the most out of CloudNexus Object Storage.

Performance

  • Use multipart uploads for files > 100 MB to improve throughput and enable resumable transfers
  • Enable HTTP caching headers (Cache-Control) for static assets to reduce request costs
  • Use range requests for streaming media and large file downloads
  • Deploy your application in the same region as your storage bucket to minimize latency

Cost Optimization

  • Use lifecycle policies to automatically transition cold data to cheaper tiers
  • Set expiration rules for temporary files (logs, temp uploads, session data)
  • Enable requester pays buckets for shared data to distribute costs
  • Monitor storage usage with CloudNexus Monitoring dashboards

Security

  • Enable server-side encryption on all buckets by default
  • Use bucket policies and IAM roles instead of sharing access keys
  • Use pre-signed URLs with short expiration times for temporary access
  • Enable access logging to audit who is accessing your objects
  • Never set production buckets to public-read unless explicitly required

Troubleshooting

Common Errors

Error HTTP Code Cause Solution
AccessDenied 403 Invalid credentials or missing permissions Verify access key/secret and bucket policy
NoSuchBucket 404 Bucket name is misspelled or does not exist Check bucket name spelling and region
NoSuchKey 404 Object key does not exist Verify the object key (path) is correct
RequestTimeout 408 Request exceeded timeout Retry with exponential backoff; check network
SlowDown 503 Too many requests (rate limiting) Implement throttling or use multipart upload
BucketNotEmpty 409 Attempting to delete a non-empty bucket Delete all objects and versions first
EntityTooLarge 413 Single PUT exceeds 5 GB limit Use multipart upload for large files

Debug Tips

  1. Enable verbose logging on the CLI: cn storage --debug
  2. Use curl to test raw API requests and inspect response headers
  3. Check the Access Logs for detailed request auditing
  4. Verify your endpoint URL matches the region where the bucket was created
⚡
Cross-Region Requests

If you connect to the wrong region endpoint for a bucket, you'll receive a 301 Moved Permanently redirect. Always use the correct regional endpoint to avoid latency and potential redirect loops.