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 |
Configures an access point policy. | |
Queries the configuration of an access point policy. | |
Deletes an access point policy. | |
Lists all objects in a bucket. | |
Uploads an object. | |
Queries an object. | |
Copies an object. | |
Uploads an object by using append upload. | |
Deletes an object. | |
Deletes multiple objects at a time. | |
Queries all metadata of an object without returning the content of the object. | |
Queries some metadata of an object, including ETag, Size, and LastModified, without returning the content of the object. | |
Uploads an object by using an HTML form. | |
Restores Archive, Cold Archive, and Deep Cold Archive objects. | |
Executes SQL statements on an object and queries the execution results. | |
Initiates a multipart upload task. | |
Uploads an object by part based on the specified object name and the upload ID. | |
Copies data from an existing object to upload a part by adding the x-oss-copy-source request header to an UploadPart request. | |
Completes a multipart upload task by combining all uploaded parts into a single object. | |
Cancels a multipart upload task and deletes the uploaded parts. | |
Lists all ongoing multipart upload tasks, which include tasks that are initiated but are not completed or canceled. | |
Lists all parts uploaded by a multipart upload task that has the specified upload ID. | |
Configures the ACL of an object. | |
Queries the ACL of an object. | |
Creates a symbolic link. | |
Queries a symbolic link. | |
Configures tags for or updates the tags of an object. | |
Queries the tags of an object. | |
Deletes the tags of an object. |