Stéphane GRILLON
Stéphane GRILLON

Reputation: 11862

How to set S3v2 api to Minio (AWS S3 local) in a docker-compose

My origin docker-compose is :

s3:
    image: minio/minio
    command: server /data --console-address ":9001"
    ports:
      - 9000:9000
      - 9001:9001
    networks:
      - lambda-local

is it possible to set S3v2 by default when docker starts?

EDIT

I use some Python AWS Lambda and AWS S3 (S3v2) in production. My code is ready for use S3v2 only.

In my computer (for develop unit tests), I want juste switch S3 by Minio started by docker-compose.

I do not want change my Lambda code. I need change Minio local install (docker-compose).

This change of S3 by Minio must be transparent for my application.

Upvotes: 1

Views: 2074

Answers (1)

rkumar-minio
rkumar-minio

Reputation: 732

So the MinIO Server supports both S3v4 and S3v2 without any additional configuration required. As Prakash noted, it's typically an SDK setting.

You can test this yourself using the mc commandline tool:

mc alias set --api "S3v4" myminiov4 http://localhost:9000 minioadmin minioadmin

mc alias set --api "S3v2" myminiov2 http://localhost:9000 minioadmin minioadmin

echo "foo" > foo.txt
echo "bar" > bar.txt

mc mb myminiov4/testv4
mc mb myminiov2/testv2

mc cp foo myminiov4/testv4/foo
mc cp bar myminiov2/testv2/bar

You can read either file using either alias - one which is using Signature v4 and another using Signature v2.

You should defer to the documentation for your preferred SDK on how to set this value. It's worth noting that Sv2 is deprecated - newer SDK versions might not even support it. So you'll first need to confirm that the version of your preferred SDK supports Sv2 at all, and then enable it when connecting to MinIO. I did not, for example, find an obvious way of setting it in the AWS Java SDK docs (though maybe I just missed it).

MinIO's GO SDK appears to support it via an override, but I haven't tested it myself yet.

If you have a specific application which requires Sv2 that isn't working, you'll need to provide more detail before getting further guidance. From a MinIO perspective, I'm not aware of any specific restrictions on either signature version.

Disclaimer: I work for MinIO.

Upvotes: 2

Related Questions