Flow Documentation
Company PagePlatform Status
  • Overview
  • Platform
    • Release Notes
    • Pricing
      • Compute
      • Kubernetes
      • App Engine
      • Object Storage
      • Mac Bare Metal
      • CI Engine
      • DevOps Services
      • Volumes & Snapshots
      • Load Balancers
      • Elastic IPs
      • VPN & Peering
      • Licenses
      • Support
      • Billing FAQ
    • Account
      • Sign Up
      • Closing account
    • Cashback Program
    • Support
      • Case severity and initial response times
    • Service Level Agreement (SLA)
    • Security & Compliance
      • Log4j Vulnerability
    • Regions
      • ALP1
      • ALP2
      • ZRH1
  • Products
    • Compute
      • Instances
        • How-to
          • Connect to instances
          • Destroy Instances
      • Volumes
      • Keypairs
      • ▫️Networking
        • Private Networks
        • Routers
        • Security Groups
        • Elastic IPs
        • Load Balancers
          • Balancing Pools
        • Certificates
        • VPN & Peering
    • Kubernetes
      • Clusters
      • Resources
        • Volumes Features (CSI)
        • External Load Balancers
        • Cluster Autoscaler
        • Traefik upgrade and tests
        • Update custom resource definitions (CRDs) for VolumeSnapshots
    • Object Storage
      • Instances
      • How-to
        • Access Storage with AWS S3 SDKs
        • Access Storage with Cyberduck
        • Access Storage with Mountainduck
      • Ressources
        • Supported Amazon S3 features
        • Replication Management
          • GET service replication
          • PUT service replication
          • DELETE service replication
    • App Engine
      • Accounts
    • Mac Bare Metal
      • Devices
      • How-to
        • Connect via Remote Desktop
        • Connect via SSH
        • Change Display Resolution
        • Connect local USB devices
      • Resources
        • Deprovisioning
    • CI Engine
      • Subscriptions
      • How-to
        • Setup GitHub Actions Integration
        • Setup Buildkite Integration
        • Customise Image
        • Enable Debug Mode
        • Change Image of Integration
      • Resources
        • Runners & Concurrency
        • Vanilla Images
          • macOS 15.2 - Vanilla
        • Golden Images
          • macOS 15.2 - Golden
        • Custom Images
  • Developer Center
    • Overview
    • API
      • Product Entities
      • Location Entities
    • CLI
    • Terraform
Powered by GitBook
On this page
  • Introduction
  • Install the SDK
  • Obtain Access & Secret Keys
  • SDKs
  1. Products
  2. Object Storage
  3. How-to

Access Storage with AWS S3 SDKs

PreviousHow-toNextAccess Storage with Cyberduck

Last updated 2 years ago

Introduction

Flow Object Storage is an S3-compatible object storage service that lets you store and serve large amounts of data.

The Flow Object Storage API is inter-operable with the AWS S3 API, meaning you can use existing S3 tools and libraries with Spaces. A common use case is managing Flow Object Storage programmatically with AWS’ S3 SDKs.

Install the SDK

Install the AWS SDK using the package manager for your language of choice.

npm install aws-sdk
go get -u github.com/aws/aws-sdk-go
php composer.phar require aws/aws-sdk-php
pip install boto3
gem install aws-sdk-s3

Obtain Access & Secret Keys

You are able to retrieve the access & secret keys in our customer portal:

The examples below rely on environment variables to access these keys. Export ACCESS_KEY and SECRET_KEY to your environment (e.g. export ACCESS_KEY=DSJE2334JAS) to make them available to your code.

SDKs

After you set up and configure an SDK, you can follow the examples below to see how to perform common Flow Object Storage operations in JavaScript, Go, PHP, Python and Ruby.

const AWS = require('aws-sdk');
const fs = require('fs'); // Needed for example below

const spacesEndpoint = new AWS.Endpoint('<S3-ENDPOINT>');
const s3 = new AWS.S3({
    endpoint: spacesEndpoint,
    accessKeyId: process.env.ACCESS_KEY,
    secretAccessKey: process.env.SECRET_KEY
});
package main

import (
    "os"
    // Additional imports needed for examples below
    "fmt"
    "io"
    "strings"
    "time"

    "github.com/aws/aws-sdk-go/aws"
    "github.com/aws/aws-sdk-go/aws/credentials"
    "github.com/aws/aws-sdk-go/aws/session"
    "github.com/aws/aws-sdk-go/service/s3"
)

func main() {
    key := os.Getenv("ACCESS_KEY")
    secret := os.Getenv("SECRET_KEY")

    s3Config := &aws.Config{
        Credentials: credentials.NewStaticCredentials(key, secret, ""),
        Endpoint:    aws.String("https://<ENDPOINT>"),
        Region:      aws.String("us-east-1"),
    }

    newSession := session.New(s3Config)
    s3Client := s3.New(newSession)

    // ...

This SDK requires the region to be us-east-1, an AWS region name, to successfully create a new Bucket. The Flow Object Storage datacenter region is based on the <ENDPOINT> value.

<?php

// Included aws/aws-sdk-php via Composer's autoloader
require 'vendor/autoload.php';
use Aws\S3\S3Client;

$client = new Aws\S3\S3Client([
        'version' => 'latest',
        'region'  => 'us-east-1',
        'endpoint' => 'https://<ENDPOINT>',
        'credentials' => [
                'key'    => getenv('ACCESS_KEY'),
                'secret' => getenv('SECRET_KEY'),
            ],
]);
import os
import boto3

session = boto3.session.Session()
client = session.client('s3',
                        region_name='nyc3',
                        endpoint_url='https://<ENDPOINT>',
                        aws_access_key_id=os.getenv('ACCESS_KEY'),
                        aws_secret_access_key=os.getenv('SECRET_KEY'))
require 'aws-sdk-s3'

client = Aws::S3::Client.new(
  access_key_id: ENV['ACCESS_KEY'],
  secret_access_key: ENV['SECRET_KEY'],
  endpoint: 'https://<ENDPOINT>',
  region: 'us-east-1'
)

Please replace the <ENDPOINT> place holder with the correct endpoint: Location ALP1: os.alp1.flow.swiss Location ZRH1: os.zrh1.flow.swiss

https://my.flow.swiss/#/object-storage