0

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.

Stéphane GRILLON
  • 11,140
  • 10
  • 85
  • 154

1 Answers1

2

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.

rkumar-minio
  • 672
  • 5
  • 7
  • I edit the question because, your answer is correct but does not answer my question. – Stéphane GRILLON Feb 25 '22 at 08:11
  • I'm not sure how the answer changes Stephane, Your lambda code would need to target MinIO instead of S3. I'm not sure AWS Lambda lets you target an arbitrary S3-compatible endpoint, but if it does you would need to point it at your docker-hosted MinIO (probably using port forwarding to make it work). More likely, you will need to deploy a local container that runs your lambda code and points to MinIO instead of S3. All of this is implementation details, and not anything specific to MinIO. It kind of sounds like you expect MinIO to handle client behavior here. It's a bit confusing. – rkumar-minio Feb 25 '22 at 17:12
  • yes I deploy a local container which is running my lambda code and pointing to MinIO instead of S3. I do this in my unit tests – Stéphane GRILLON Feb 28 '22 at 08:12
  • As far as I know that should just work. Are you seeing a specific error? What version of MinIO are you running? – rkumar-minio Feb 28 '22 at 17:01
  • I use docker, so is it last version – Stéphane GRILLON Feb 28 '22 at 19:30
  • OK - as noted, I'm not aware of any restrictions on the MinIO side here. If you see specific errors, you might need to post a separate python-specific question including the SDK you are using and the errors, warnings, or behaviors you are seeing. – rkumar-minio Mar 01 '22 at 20:02