Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS S3 local server for integration testing

I have some code that uploads and downloads files using AWS S3 (using the Java AWS SDK). I want to be able to write some tests for it, I was wondering if anyone has any good options. Ideally I would like a light-weight S3 server that runs locally that can be started fast and requires no system configuration (the tests need to be run by Jenkins).

Some options I have looked at so far:

  1. FakeS3 - Almost exactly what I'm looking for, however, when using the Java AWS SDK, you must edit your /etc/hosts file and restart networking, not something I can do in Jenkins. Also when trying it out there seems to be a bug with the creation date field being formatted wrong which makes my client throw an exception, which doesn't inspire me with much confidence in the project.
  2. Ceph - Implements S3 API but takes several minutes to install
like image 532
oggmonster Avatar asked Jun 02 '14 09:06

oggmonster


People also ask

Can you run S3 locally?

Object storage is amazingly versatile. We normally associate it with AWS S3, but Object Storage can also be run on your private network with MinIO. In this article, I'll show you how to install MinIO using Docker and also on a Mac using homebrew.

How do I integrate AWS S3?

Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that you want to create a bucket policy for or whose bucket policy you want to edit. Choose Permissions. Under Bucket policy, choose Edit.

How do you mock in AWS?

Prepare and run sample ApplicationSend POST request to http://localhost:4000/api/document/ and pass the files using form-data with a key as a file, and value with an image. I recommend localstack if you are building applications and using AWS services.

Is Amazon S3 an API?

This guide explains the Amazon Simple Storage Service (Amazon S3) application programming interface (API). It describes various API operations, related request and response structures, and error codes. The current version of the Amazon S3 API is 2006-03-01.


2 Answers

You can try localstack, which is an open source local AWS cloud stack made for testing. It provides implementations of several of AWS services, including S3.

It looks like a very popular open source project on GitHub.

like image 132
Flux Avatar answered Oct 10 '22 17:10

Flux


You can try installing minio server on your laptop/system, its open source & single static binary. Server is S3 compatible. Then you can try minio-java client library for all operations, following is basic operations example.

Installing minio server [GNU/Linux]

$ wget https://dl.minio.io/server/minio/release/linux-amd64/minio $ chmod 755 minio $ ./minio --help   

Hope it helps Disclaimer: I work for Minio

like image 23
koolhead17 Avatar answered Oct 10 '22 17:10

koolhead17