For the complete documentation index, see llms.txt. This page is also available as Markdown.

S3 API Usage

Example Usage

S3 API Actions

AWS CLI

You can use the AWS command line interface to send S3 API requests to the Alluxio S3 API. Note that you will have to provide the --endpoint parameter to specify the location of the Alluxio S3 REST API with the server's base URI included. The endpoint format is --endpoint "http://{alluxio.worker.web.hostname}:{alluxio.worker.rest.port}/".

As a prerequisite for operations which involve the Authorization header you may need to configure AWS credentials.

$ aws configure --profile alluxio-s3
AWS Access Key ID [None]: {user}
AWS Secret Access Key [None]: {dummy value}
Default region name [None]:
Default output format [None]:
REST Clients

You can directly use any HTTP client to send S3 API requests to the Alluxio S3 API. The base URI is /; requests should be directed to http://{alluxio.worker.web.hostname}:{alluxio.worker.rest.port}/.

At the moment, access key and secret key validation does not exist for the Alluxio S3 API. Therefore the Authorization header is used purely to specify the intended user to perform a request. The header follows the AWS Signature Version 4 format.

$ curl -i -H "Authorization: AWS4-HMAC-SHA256 Credential=testuser/... SignedHeaders=... Signature=..." ...

CopyObject

AWS CLI
$ aws --profile alluxio-s3 --endpoint "http://localhost:29998/" s3api copy-object \
  --copy-source=testbucket/test.txt --bucket=testbucket --key=test_copy.txt
{
    "CopyObjectResult": {
        "ETag": "911df44b7ff57801ca8d74568e4ebfbe",
        "LastModified": "2022-05-03T11:37:16.015000+00:00"
    }
}

$ aws --profile alluxio-s3 --endpoint "http://localhost:29998/" s3api list-objects \
  --bucket=testbucket
{
    "Contents": [
        {
            "Key": "test.txt",
            "LastModified": "2022-05-03T11:35:59.243000+00:00",
            "Size": 27040
        },
        {
            "Key": "test_copy.txt",
            "LastModified": "2022-05-03T11:37:16.185000+00:00",
            "Size": 27040
        }
    ]
}
REST Clients
$ curl -i -H "Authorization: AWS4-HMAC-SHA256 Credential=testuser/... SignedHeaders=... Signature=..." \
  -H "x-amz-copy-source: testbucket/test.txt" \
  -X PUT http://localhost:29998/testbucket/test_copy.txt
HTTP/1.1 200 OK
Date: Tue, 03 May 2022 21:50:07 GMT
Content-Type: application/xml
Content-Length: 135
Server: Jetty(9.4.43.v20210629)

<CopyObjectResult>
  <ETag>911df44b7ff57801ca8d74568e4ebfbe</ETag>
  <LastModified>2022-05-03T14:50:07.781Z</LastModified>
</CopyObjectResult>

$ curl -i -H "Authorization: AWS4-HMAC-SHA256 Credential=testuser/... SignedHeaders=... Signature=..." \
  -X GET http://localhost:29998/testbucket
HTTP/1.1 200 OK
Date: Tue, 03 May 2022 21:50:26 GMT
Content-Type: application/xml
Content-Length: 434
Server: Jetty(9.4.43.v20210629)

<ListBucketResult>
  <version2>false</version2>
  <Contents>
    <Key>test.txt</Key>
    <Size>27040</Size>
    <LastModified>2022-05-03T14:47:36.600Z</LastModified>
  </Contents>
  <Contents>
    <Key>test_copy.txt</Key>
    <Size>27040</Size>
    <LastModified>2022-05-03T14:50:07.790Z</LastModified>
  </Contents>
  <Marker/>
  <IsTruncated>false</IsTruncated>
  <Prefix/>
  <Name>testbucket</Name>
  <MaxKeys>1000</MaxKeys>
  <EncodingType>url</EncodingType>
</ListBucketResult>

CreateBucket

AWS CLI
REST Clients

DeleteBucket

AWS CLI
REST Clients

DeleteBucketTagging

AWS CLI
REST Clients

DeleteObject

AWS CLI
REST Clients

DeleteObjects

AWS CLI
REST Clients

DeleteObjectTagging

AWS CLI
REST Clients

GetBucketTagging

AWS CLI
REST Clients

GetObject

AWS CLI
REST Clients

GetObjectTagging

AWS CLI
REST Clients

HeadBucket

AWS CLI
REST Clients

HeadObject

AWS CLI
REST Clients

ListBuckets

AWS CLI
REST Clients

ListObjects

AWS CLI
REST Clients

ListObjectsV2

AWS CLI
REST Clients

PutBucketTagging

AWS CLI
REST Clients

PutObject

AWS CLI
REST Clients

PutObjectTagging

AWS CLI
REST Clients

Last updated