Skip to content

Quickstart

Create a bucket and an access key, then upload, list and download an object with boto3.

Updated View as Markdown

1. Create a bucket

  1. In the console, open Object Storage and select Buckets.
  2. Select Create bucket and enter a name. Names are unique across all customers.

Or with the CLI:

ezgh objects buckets create my-bucket

2. Create an access key

  1. Select Access keys, then Create access key.
  2. Copy the access key ID and the secret. The secret is shown once.

Or with the CLI, which prints the secret once:

ezgh objects keys create --description quickstart

Put them in your environment:

export AWS_ACCESS_KEY_ID="oak_…"
export AWS_SECRET_ACCESS_KEY="…"

3. Upload, list and download

pip install boto3
import boto3
from botocore.config import Config

s3 = boto3.client(
    "s3",
    endpoint_url="https://s3.us-west-1.ezghapps.com",
    region_name="us-west-1",
    config=Config(signature_version="s3v4"),
)

s3.put_object(Bucket="my-bucket", Key="hello.txt", Body=b"Hello")

for item in s3.list_objects_v2(Bucket="my-bucket").get("Contents", []):
    print(item["Key"], item["Size"])

print(s3.get_object(Bucket="my-bucket", Key="hello.txt")["Body"].read())

Replace my-bucket with your bucket’s name. To download, the key’s owner needs objects.objects.download.

Next steps

Navigation

Type to search…

↑↓ navigate↵ selectEsc close