This topic describes how to access an OSS resource from a Simple Application Server instance in the same region by using an internal endpoint.
Prerequisites
-
You have created a Simple Application Server instance. For more information, see Create a server.
-
You have created a bucket. For more information, see Create buckets.
Background
Object Storage Service (OSS) is a secure, cost-effective, and highly reliable cloud storage service that allows you to store large amounts of data of any type. It features elastic scaling for capacity and processing power and offers multiple storage classes to help you optimize storage costs. For more information, see Object Storage Service (OSS).
Procedure
Simple Application Server instances can access OSS resources in the same region over the internal network. You cannot directly access OSS resources in a different region by using an internal endpoint. To access resources in a different region, you must use the public endpoint.
-
Obtain the OSS internal endpoint.
-
Log on to the OSS console.
-
In the left-side navigation pane, click Buckets.
-
Click the name of the target bucket.
-
In the left-side navigation pane, click Overview.
-
In the Port section, find the endpoint and bucket domain name.
The Port section displays three access methods: Public (endpoint:
oss-cn-hangzhou.aliyuncs.com), Classic Network Access (Internal), and VPC Access (Internal). The endpoint for both internal access methods isoss-cn-hangzhou-internal.aliyuncs.com. To access the bucket from your Simple Application Server instance, use the internal endpoint and the corresponding bucket domain name, which follows the formatBucketName.oss-cn-hangzhou-internal.aliyuncs.com.
-
-
Access the OSS resource.
-
Connect to the Simple Application Server instance.
For more information, see Connect to a Linux server and Connect to a Windows server.
-
Access the OSS resource from the Simple Application Server instance by using the internal endpoint.
You can use one of the following methods to access an OSS resource from a Simple Application Server instance in the same region:
-
Access the OSS resource directly by using a URL
You can directly access an OSS resource by using its internal URL, provided you have the required permissions. For example, consider a bucket named test in the China (Hangzhou) region. It contains a file named test.txt in the root directory, and the file's permission is set to public-read. In this case, any Simple Application Server instance in the China (Hangzhou) region can access this file by using the URL http://test.oss-cn-hangzhou-internal.aliyuncs.com/test.txt.
-
Windows server: Enter
http://test.oss-cn-hangzhou-internal.aliyuncs.com/test.txtin a browser to access the test.txt file. -
For a Linux server: Run the command
wget http://test.oss-cn-hangzhou-internal.aliyuncs.com/test.txtto access the test.txt file.
WarningFor data security, avoid setting your OSS resources to public-read or public-read-write. You can use a bucket policy to grant access to specific users.
-
-
Use ossbrowser
When you configure parameters for access to OSS resources by using ossbrowser, set Endpoint to the internal endpoint of OSS. For more information, see Common operations.
-
Use ossutil
When you configure parameters for access to OSS resources by using ossutil, set Endpoint to the internal endpoint of OSS. For more information, see ossutil 2.0 command-line tool.
-
-
Related documents
If your Simple Application Server instance needs to connect to other Alibaba Cloud services in a Virtual Private Cloud (VPC), such as Elastic Compute Service (ECS) instances or ApsaraDB instances, see Manage service interconnection.