

# Using access points
<a name="access-points-usage-examples"></a>

The following examples demonstrate how to use access points to access file data stored on an FSx for OpenZFS volume using the S3 API. For a full list of the Amazon S3 API operations supported by access points attached to an FSx for OpenZFS volume, see [Access point compatibility](access-points-object-api-support.md). 

**Note**  
Files on FSx for OpenZFS volumes are identified with a `StorageClass` of `FSX_OPENZFS`.

**Topics**
+ [Downloading a file using an S3 access point](get-object-ap.md)
+ [Uploading a file using an S3 access point](put-object-ap.md)
+ [Listing files using an S3 access point](list-object-ap.md)
+ [Tagging a file using an S3 access point](add-tag-set-ap.md)
+ [Deleting a file using an S3 access point](delete-object-ap.md)

# Downloading a file using an S3 access point
<a name="get-object-ap"></a>

The following `get-object` example command shows how you can use the AWS CLI to download a file through an access point. You must include an outfile, which is a file name for the downloaded object.

The example requests the file *`my-image.jpg`* through the access point *`my-openzfs-ap`* and saves the downloaded file as *`download.jpg`*.

```
$ aws s3api get-object --key my-image.jpg --bucket my-openzfs-ap-hrzrlukc5m36ft7okagglf3gmwluquse1b-ext-s3alias download.jpg
{
    "AcceptRanges": "bytes",
    "LastModified": "Mon, 14 Oct 2024 17:01:48 GMT",
    "ContentLength": 141756,
    "ETag": "\"00751974dc146b76404bb7290f8f51bb\"",
    "ContentType": "binary/octet-stream",
    "ServerSideEncryption": "SSE_FSX",
    "Metadata": {},
    "StorageClass": "FSX_OPENZFS"
}
```

You can also use the REST API to download an object through an access point. For more information, see [https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html) in the *Amazon Simple Storage Service API Reference*.

# Uploading a file using an S3 access point
<a name="put-object-ap"></a>

The following `put-object` example command shows how you can use the AWS CLI to upload a file through an access point. You must include an outfile, which is a file name for the uploaded object.

The example uploads the file *`my-new-image.jpg`* through the access point *`my-openzfs-ap`* and saves the uploaded file as *`my-new-image.jpg`*.

```
$ aws s3api put-object --bucket my-openzfs-ap-hrzrlukc5m36ft7okagglf3gmwluquse1b-ext-s3alias --key my-new-image.jpg --body  my-new-image.jpg
```

You can also use the REST API to upload an object through an access point. For more information, see [https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html) in the *Amazon Simple Storage Service API Reference*.

# Listing files using an S3 access point
<a name="list-object-ap"></a>

The following example lists files through the access point alias `my-openzfs-ap-hrzrlukc5m36ft7okagglf3gmwluquse1b-ext-s3alias` owned by account ID *`111122223333`* in Region *`us-east-2`*.

```
$ aws s3api list-objects-v2 --bucket my-openzfs-ap-hrzrlukc5m36ft7okagglf3gmwluquse1b-ext-s3alias
{
    "Contents": [
        {
            "Key": ".hidden-dir-with-data/file.txt",
            "LastModified": "2024-10-29T14:22:05.4359",
            "ETag": "\"88990077ab44cd55ef66aa77\"",
            "Size": 18,
            "StorageClass": "FSX_OPENZFS"
        },
        {
            "Key": "documents/report.rtf",
            "LastModified": "2024-11-02T10:18:15.6621",
            "ETag": "\"ab12cd34ef56a89219zg6aa77\"",
            "Size": 1048576,
            "StorageClass": "FSX_OPENZFS"
        },
    ]
}
```

You can also use the REST API to list your files. For more information, see [https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html) in the *Amazon Simple Storage Service API Reference*.

# Tagging a file using an S3 access point
<a name="add-tag-set-ap"></a>

The following `put-object-tagging` example command shows how you can use the AWS CLI to add a tag-set through an access point. Each tag is a key-value pair. For more information, see [Categorizing your storage using tags](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html) in the *Amazon Simple Storage Service User Guide*.

The example adds a tag-set to the existing file `my-image.jpg` using the access point *`my-openzfs-ap`*.

```
$ aws s3api put-object-tagging --bucket my-openzfs-ap-hrzrlukc5m36ft7okagglf3gmwluquse1b-ext-s3alias --key my-image.jpg --tagging TagSet=[{Key="finance",Value="true"}] 
```

You can also use the REST API to add a tag-set to an object through an access point. For more information, see [https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectTagging.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectTagging.html) in the *Amazon Simple Storage Service API Reference*.

# Deleting a file using an S3 access point
<a name="delete-object-ap"></a>

The following `delete-object` example command shows how you can use the AWS CLI to delete a file through an access point.

```
$ aws s3api delete-object --bucket my-openzfs-ap-hrzrlukc5m36ft7okagglf3gmwluquse1b-ext-s3alias --key my-image.jpg 
```

You can also use the REST API to delete an object through an access point. For more information, see [https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html) in the *Amazon Simple Storage Service API Reference*.