Thumbnail for Create an Open Source AWS S3 Server

Create an Open Source AWS S3 Server

Linux.com5 min read

Amazon S3 (Simple Storage Service) is a powerful online file storage web service from Amazon Web Services. However, it requires credit card information and paid usage. Several open source alternatives exist that emulate the S3 API.

Open Source S3 Alternatives

Fake S3 is a Ruby gem that installs in seconds. It's great to get started but does not implement all S3 commands and is not suited for production usage.

HPE Helion Eucalyptus offers comprehensive AWS services emulation including S3 support. It's enterprise-oriented but heavyweight for individuals and small businesses, running only on CentOS.

Scality S3 Server is the recommended option. Available via Docker, it's super easy to start and distribute. It works for individuals getting started in seconds, plus enterprises needing production-ready, scalable solutions.

Getting Started with Scality S3 Server

Requirements

  • Docker installed
  • Ruby installed

Launch the Server

Run the Docker container:

docker run -d --name s3server -p 8000:8000 scality/s3server

Verify it's running with docker ps.

Install AWS SDK

gem install aws-sdk

Create and Upload a File

Create a test file and a Ruby script (s3_script.rb):

#!/usr/bin/ruby
require 'aws-sdk'
s3 = Aws::S3::Client.new(
  :access_key_id => 'accessKey1',
  :secret_access_key => 'verySecretKey1',
  :region => 'us-west-2',
  :endpoint => 'http://0.0.0.0:8000/',
  :force_path_style => true
)
s3.create_bucket({bucket: "mybucket"})
File.open('myfavoritefile', 'rb') do |file|
  s3.put_object(bucket: 'mybucket', key: 'myfavoritefile', body: file)
end
resp = s3.list_objects_v2(bucket: 'mybucket')
puts resp.contents(&:key)

Run it: ruby s3_script.rb

The script creates a bucket, uploads a file, and lists bucket contents — demonstrating a functional S3-compatible server running locally.

Topics

Open SourceCloud NativeDeveloper Tools