1 Middleware storage class override
Andrew Gaul edytuje tę stronę 2024-07-26 08:16:19 +03:00

Some tools are configured to write to s3 with no option to configure the storageclass. This middleware will let those tools use the proxy with default or no storageclass and the proxy will write to the proxied s3 with a target storageclass.

Here is an example configuration used by a tools that do not support storageClass for writing to aws S3 using the standard-ia class.

Create the s3proxy.properties file

s3proxy.storage-class-blobstore=STANDARD_IA
s3proxy.endpoint=http://127.0.0.1:8080
s3proxy.authorization=aws-v2-or-v4
s3proxy.identity=local-identity
s3proxy.credential=local-credential
jclouds.provider=aws-s3
jclouds.identity=AKIAXXXXXXXXXXXXXXXXXX
jclouds.credential=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY

Start the s3proxy service

./s3proxy --properties s3proxy.properties

Then with this configuration you can run this test

export AWS_ACCESS_KEY_ID=local-identity
export AWS_SECRET_ACCESS_KEY=local-credential
echo "put me in test" > test.txt
aws s3 --endpoint-url http://127.0.0.1:8080 cp test.txt s3://mcourcy-testia/test.txt
aws  s3api head-object --endpoint-url http://127.0.0.1:8080 --bucket mcourcy-testia --key test.txt

The output

{
    "LastModified": "2024-07-21T17:00:44+00:00",
    "ContentLength": 15,
    "ETag": "\"a99a4b4b9e8204c1489f9f37dd21ec1f\"",
    "ContentEncoding": "",
    "ContentType": "text/plain",
    "Metadata": {},
    "StorageClass": "STANDARD_IA"
}

Shows that the object has been created to the target storage class.

The possible value for s3proxy.storage-class-blobstore is STANDARD, STANDARD_IA, GLACIER and DEEP_ARCHIVE.