All Products
Search
Document Center

Object Storage Service:Use an access point

Last Updated:Apr 02, 2024

After you create an access point, Object Storage Service (OSS) automatically generates an alias for the access point. You can use the alias of an access point to access the data with which the access point is associated.

Prerequisites

An access point is created. For more information, see Create an access point.

Use OSS SDKs

Only OSS SDK for Java V3.16.3 and later and OSS SDK for Python V2.18.0 and later allow you to download data from OSS by using an access point alias.

Java

// If the access point has an Internet network source, you can use the public endpoint or the internal endpoint of the bucket. 
String endpoint = "https://oss-cn-hangzhou.aliyuncs.com";
// If the access point has a VPC network source, you must use the internal endpoint of the bucket. 
// String endpoint = "https://oss-cn-hangzhou-internal.aliyuncs.com";
// Specify the access point alias. 
String bucketName = "ap-01-d571827a1e2ed76490899a8a922262****-ossalias";

Python

# If the access point has an Internet network source, you can use the public endpoint or the internal endpoint of the bucket. 
endpoint = "https://oss-cn-hangzhou.aliyuncs.com"
# If the access point has a VPC network source, you must use the internal endpoint of the bucket. 
# endpoint = "https://oss-cn-hangzhou-internal.aliyuncs.com"
# Specify the access point alias. 
bucket_name = "ap-01-d571827a1e2ed76490899a8a922262****-ossalias"

Use ossutil

When you use ossutil to access data in a bucket by using an access point alias, the access point alias functions as the bucket name. The following sample command provides an example on how to use an access point alias to access data in OSS:

ossutil cp oss://ap-01-d571827a1e2ed76490899a8a922262****-ossalias/demo.txt /Users/demo/Desktop/demo.txt

For more information about common commands, see Common commands.

Use RESTful APIs

When you use an API operation and an access point alias to request resources in a bucket, you need to include the access point alias in the Host header. The following sample request provides an example on how to use an access point alias to access data in OSS:

GET /ObjectName HTTP/1.1
Host: ap-01-9387d8ec9e23cb25320effffd78374****-ossalias.oss-cn-hangzhou.aliyuncs.com 
Date: GMT Date
Authorization: SignatureValue

Access point alias-compatible operations

You can use an access point alias to call the following operations.

API operation

Description

PutAccessPointPolicy

Configures an access point policy.

GetAccessPointPolicy

Queries the configuration of an access point policy.

DeleteAccessPointPolicy

Deletes an access point policy.

ListObjects (GetBucket)

Lists all objects in a bucket.

ListObjectsV2 (GetBucketV2)

PutObject

Uploads an object.

GetObject

Queries an object.

CopyObject

Copies an object.

AppendObject

Uploads an object by using append upload.

DeleteObject

Deletes an object.

DeleteMultipleObjects

Deletes multiple objects at a time.

HeadObject

Queries all metadata of an object without returning the content of the object.

GetObjectMeta

Queries some metadata of an object, including ETag, Size, and LastModified, without returning the content of the object.

PostObject

Uploads an object by using an HTML form.

RestoreObject

Restores Archive, Cold Archive, and Deep Cold Archive objects.

SelectObject

Executes SQL statements on an object and queries the execution results.

InitiateMultipartUpload

Initiates a multipart upload task.

UploadPart

Uploads an object by part based on the specified object name and the upload ID.

UploadPartCopy

Copies data from an existing object to upload a part by adding the x-oss-copy-source request header to an UploadPart request.

CompleteMultipartUpload

Completes a multipart upload task by combining all uploaded parts into a single object.

AbortMultipartUpload

Cancels a multipart upload task and deletes the uploaded parts.

ListMultipartUploads

Lists all ongoing multipart upload tasks, which include tasks that are initiated but are not completed or canceled.

ListParts

Lists all parts uploaded by a multipart upload task that has the specified upload ID.

PutObjectACL

Configures the ACL of an object.

GetObjectACL

Queries the ACL of an object.

PutSymlink

Creates a symbolic link.

GetSymlink

Queries a symbolic link.

PutObjectTagging

Configures tags for or updates the tags of an object.

GetObjectTagging

Queries the tags of an object.

DeleteObjectTagging

Deletes the tags of an object.