storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/docs/gateway/s3.md (about)

     1  # MinIO S3 Gateway [![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io)
     2  
     3  MinIO S3 Gateway adds MinIO features like MinIO Browser and disk caching to AWS S3 or any other AWS S3 compatible service.
     4  
     5  ## Run MinIO Gateway for AWS S3
     6  As a prerequisite to run MinIO S3 gateway, you need valid AWS S3 access key and secret key by default. Optionally you can also set custom access/secret key, when you have rotating AWS IAM credentials or AWS credentials through environment variables (i.e. AWS_ACCESS_KEY_ID)
     7  
     8  ### Using Docker
     9  ```
    10  docker run -p 9000:9000 --name minio-s3 \
    11   -e "MINIO_ROOT_USER=aws_s3_access_key" \
    12   -e "MINIO_ROOT_PASSWORD=aws_s3_secret_key" \
    13   minio/minio gateway s3
    14  ```
    15  
    16  ### Using Binary
    17  ```
    18  export MINIO_ROOT_USER=aws_s3_access_key
    19  export MINIO_ROOT_PASSWORD=aws_s3_secret_key
    20  minio gateway s3
    21  ```
    22  
    23  ### Using Binary in EC2
    24  Using IAM rotating credentials for AWS S3
    25  
    26  If you are using an S3 enabled IAM role on an EC2 instance for S3 access, MinIO will still require env vars MINIO_ROOT_USER and MINIO_ROOT_PASSWORD to be set for its internal use. These may be set to any value which meets the length requirements. Access key length should be at least 3, and secret key length at least 8 characters.
    27  ```
    28  export MINIO_ROOT_USER=custom_access_key
    29  export MINIO_ROOT_PASSWORD=custom_secret_key
    30  minio gateway s3
    31  ```
    32  
    33  MinIO gateway will automatically look for list of credential styles in following order, if your backend URL is AWS S3.
    34  
    35  - AWS env vars (i.e. AWS_ACCESS_KEY_ID)
    36  - AWS creds file (i.e. AWS_SHARED_CREDENTIALS_FILE or ~/.aws/credentials)
    37  - IAM profile based credentials. (performs an HTTP call to a pre-defined endpoint, only valid inside configured ec2 instances)
    38  
    39  Minimum permissions required if you wish to provide restricted access with your AWS credentials, please make sure you have following IAM policies attached for your AWS user or roles.
    40  
    41  ```json
    42  {
    43      "Version": "2012-10-17",
    44      "Statement": [
    45          {
    46              "Sid": "readonly",
    47              "Effect": "Allow",
    48              "Action": [
    49                  "s3:GetObject",
    50                  "s3:ListBucket"
    51              ],
    52              "Resource": "arn:aws:s3:::testbucket"
    53          },
    54          {
    55              "Sid": "readonly",
    56              "Effect": "Allow",
    57              "Action": "s3:HeadBucket",
    58              "Resource": "arn:aws:s3:::testbucket"
    59          }
    60      ]
    61  }
    62  ```
    63  
    64  ## Run MinIO Gateway for AWS S3 compatible services
    65  As a prerequisite to run MinIO S3 gateway on an AWS S3 compatible service, you need valid access key, secret key and service endpoint.
    66  
    67  ## Run MinIO Gateway with double-encryption
    68  MinIO gateway to S3 supports encryption of data at rest. Three types of encryption modes are supported
    69  
    70  - encryption can be set to ``pass-through`` to backend only for SSE-S3, SSE-C is not allowed passthrough.
    71  - ``single encryption`` (at the gateway)
    72  - ``double encryption`` (single encryption at gateway and pass through to backend)
    73  
    74  This can be specified by setting MINIO_GATEWAY_SSE environment variable. If MINIO_GATEWAY_SSE and KMS are not setup, all encryption headers are passed through to the backend. If KMS environment variables are set up, ``single encryption`` is automatically performed at the gateway and encrypted object is saved at the backend.
    75  
    76  To specify ``double encryption``, MINIO_GATEWAY_SSE environment variable needs to be set to "s3" for sse-s3
    77  and "c" for sse-c encryption. More than one encryption option can be set, delimited by ";". Objects are encrypted at the gateway and the gateway also does a pass-through to backend. Note that in the case of SSE-C encryption, gateway derives a unique SSE-C key for pass through from the SSE-C client key using a key derivation function (KDF).
    78  
    79  
    80  ```sh
    81  curl -sSL --tlsv1.2 \
    82       -O 'https://raw.githubusercontent.com/minio/kes/master/root.key' \
    83       -O 'https://raw.githubusercontent.com/minio/kes/master/root.cert'
    84  ```
    85  
    86  ```sh
    87  export MINIO_GATEWAY_SSE="s3;c"
    88  export MINIO_KMS_KES_ENDPOINT=https://play.min.io:7373
    89  export MINIO_KMS_KES_KEY_FILE=root.key
    90  export MINIO_KMS_KES_CERT_FILE=root.cert
    91  export MINIO_KMS_KES_KEY_NAME=my-minio-key
    92  minio gateway s3
    93  ```
    94  
    95  ### Using Docker
    96  ```
    97  docker run -p 9000:9000 --name minio-s3 \
    98   -e "MINIO_ROOT_USER=access_key" \
    99   -e "MINIO_ROOT_PASSWORD=secret_key" \
   100   minio/minio gateway s3 https://s3_compatible_service_endpoint:port
   101  ```
   102  
   103  ### Using Binary
   104  ```
   105  export MINIO_ROOT_USER=access_key
   106  export MINIO_ROOT_PASSWORD=secret_key
   107  minio gateway s3 https://s3_compatible_service_endpoint:port
   108  ```
   109  
   110  ## MinIO Caching
   111  MinIO edge caching allows storing content closer to the applications. Frequently accessed objects are stored in a local disk based cache. Edge caching with MinIO gateway feature allows
   112  
   113  - Dramatic improvements for time to first byte for any object.
   114  - Avoid S3 [data transfer charges](https://aws.amazon.com/s3/pricing/).
   115  
   116  Refer [this document](https://docs.min.io/docs/minio-disk-cache-guide.html) to get started with MinIO Caching.
   117  
   118  ## MinIO Browser
   119  MinIO Gateway comes with an embedded web based object browser. Point your web browser to http://127.0.0.1:9000 to ensure that your server has started successfully.
   120  
   121  ![Screenshot](https://github.com/minio/minio/blob/master/docs/screenshots/minio-browser-gateway.png?raw=true)
   122  
   123  With MinIO S3 gateway, you can use MinIO browser to explore AWS S3 based objects.
   124  
   125  ### Known limitations
   126  
   127  - Bucket notification APIs are not supported.
   128  
   129  ## Explore Further
   130  
   131  - [`mc` command-line interface](https://docs.min.io/docs/minio-client-quickstart-guide)
   132  - [`aws` command-line interface](https://docs.min.io/docs/aws-cli-with-minio)
   133  - [`minio-go` Go SDK](https://docs.min.io/docs/golang-client-quickstart-guide)