すべてのプロダクト
Search
ドキュメントセンター

Object Storage Service:PrivateLink を使用してプライベートネットワーク経由で OSS にアクセス

最終更新日:May 07, 2026

PrivateLink は、Virtual Private Cloud (VPC) と Alibaba Cloud Object Storage Service (OSS) 間に安全でプライベートな接続を確立します。この接続により、ネットワーク層でのネイティブなトラフィック隔離が実現され、データ転送中のセキュリティリスクの軽減、ネットワークアドレスの競合の解消、運用の複雑さの低減が可能になります。PrivateLink を使用することで、クラウドストレージへのアクセスにおいて、安全かつ制御可能なアーキテクチャを構築できます。

仕組み

PrivateLink は、ご利用の VPC 内に専用のプライベートエンドポイントを作成し、Alibaba Cloud OSS サービスに接続することで動作します。これにより、すべてのアクセストラフィックが Alibaba Cloud のバックボーンネットワーク内のみを経由し、パブリックインターネットを通過することはありません。また、ソース IP に基づく正確なアクセス制御および VPC フローログによる監査機能を提供し、エンタープライズレベルのデータセキュリティフレームワークを構築できます。OSS が提供する内部エンドポイントと比較して、PrivateLink はより高度なネットワーク層でのセキュリティ隔離と詳細な制御機能を提供するため、以下のユースケースに適しています。

ユースケース

標準的な内部エンドポイント

PrivateLink

厳格なセキュリティおよびコンプライアンス要件

標準エンドポイントはパブリックサービスエントリを使用するため、リージョン内のすべての VPC に対して攻撃対象領域が公開されます。セキュリティ制御は主にアプリケーション層のポリシーに依存します。

攻撃対象領域を縮小します。 エンドポイントはご利用の VPC 内に配置されるため、他の VPC がこれを発見またはアクセスすることはできません。トラフィックはネットワーク層でネイティブに隔離されます。

アクセス元に対するネットワーク層での詳細な制御が必要

OSS へのアクセスをセキュリティグループで制御することはできません。バケットポリシーに依存する必要があります。

セキュリティグループのバインドをサポートします。 PrivateLink エンドポイントにセキュリティグループルールを適用することで、どのソース IP が OSS にアクセスできるかを正確に制御できます。

すべてのネットワーク接続試行を監査する必要がある

OSS アクセスログには成功したリクエストのみが記録され、ネットワーク層で拒否された接続試行は監査できません。

VPC フローログをサポートします。 接続の成否にかかわらず、エンドポイントへのアクセスを試みるすべてのトラフィックをキャプチャおよび監査できます。

IP アドレスの競合が発生する可能性のある複雑なハイブリッドクラウドネットワークアーキテクチャ

クラウドサービスはデフォルトで 100.64.0.0/10 CIDR ブロックを使用するため、オンプレミスデータセンターのネットワークプランと競合する可能性があります。

IP 競合を回避します。 エンドポイントはご利用の VPC のアドレス空間から IP アドレスを使用するため、カスタム IP プランを完全に尊重し、ハイブリッドクラウドルーティング構成を簡素化します。

対応リージョン

中国 (杭州)、中国 (上海)、中国 (青島)、中国 (北京)、中国 (張家口)、中国 (ウランチャブ)、中国 (深セン)、中国 (河源)、中国 (広州)、中国 (成都)、香港 (中国)、日本 (東京)、韓国 (ソウル)、シンガポール、インドネシア (ジャカルタ)、タイ (バンコク)、ドイツ (フランクフルト)、米国 (シリコンバレー)、米国 (バージニア)、イギリス (ロンドン)。

PrivateLink の設定と使用

VPC またはオンプレミスデータセンターから OSS リソースに安全にアクセスするための PrivateLink 接続を確立するエンドポイントを作成します。

エンドポイントの作成と検証

まず、ご利用の VPC と OSS 間に安全でプライベートな接続を確立するためのエンドポイントを作成します。エンドポイント作成後、ECS インスタンスからネットワーク接続性および OSS へのアクセスを検証し、構成が正常に機能していることを確認します。

開始前に、VPC および vSwitch を作成済みであることをご確認ください。検証手順には ECS インスタンスが必要です。既存のインスタンスがない場合は、「ECS インスタンスの購入」をご参照のうえ、従量課金インスタンスを作成してください。

ステップ 1:エンドポイントの作成

  1. VPC エンドポイントページに移動し、エンドポイントの作成 をクリックします。初回利用の場合は、画面の指示に従って PrivateLink サービスを有効化してください。

  2. 以下のパラメーターを設定します。その他のパラメーターはデフォルト値のままにしておいても問題ありません。

    • リージョン:対象の OSS バケットが配置されているリージョン(例:中国 (杭州))を選択します。

    • エンドポイント名:エンドポイントのわかりやすい名前(例:privatelink-oss)を入力します。

    • エンドポイントタイプインターフェイスエンドポイント を選択します。

    • エンドポイントサービスAlibaba Cloud サービス を選択し、サービス一覧から OSS エンドポイントサービスを選択します。サービス名は oss で終わります。

      説明

      OSS エンドポイントサービスがサービス一覧に表示されない場合は、テクニカルサポート までご連絡のうえ、有効化をリクエストしてください。

    • VPC:エンドポイントを作成する対象の VPC を選択します。利用可能な VPC がない場合は、VPC の作成 をクリックして作成します。

    • セキュリティグループ:アクセス制御のためにエンドポイントにバインドするセキュリティグループを選択します。適切なセキュリティグループがない場合は、セキュリティグループの作成 をクリックして作成します。

    • ゾーンと vSwitch:エンドポイントをデプロイする可用性ゾーンおよび対応する vSwitch を選択します。利用可能な vSwitch がない場合は、作成 をクリックして作成します。

  3. OK をクリックします。システムが自動的にエンドポイントを作成します。エンドポイント作成後、エンドポイント詳細ページに移動し、OSS にアクセスするために使用するエンドポイントサービスドメイン名を表示・コピーします。

    image

手順 2: エンドポイントを確認する

接続テストを実行し、ファイルをダウンロードして、PrivateLink エンドポイントが正常に機能していることを確認します。

  • ネットワーク接続性の検証

    ping コマンドを使用してエンドポイントのドメイン名をテストし、DNS 解決およびネットワークパスが正常に動作していることを確認します。

    ping -c 4 ep-bp1i****************.oss.cn-hangzhou.privatelink.aliyuncs.com
  • ファイルダウンロードの検証

    同一リージョン内の ECS インスタンスから ossutil を使用して OSS からファイルをダウンロードします。これにより、PrivateLink 接続のエンドツーエンドの機能が検証されます。

    1. ossutil 2.0 をインストールおよび設定します。

    2. エンドポイントのドメイン名(例:ep-bp1i****************.oss.cn-hangzhou.privatelink.aliyuncs.com)を使用して OSS リソースにアクセスします。以下の例では、example-bucket という名前のバケットから dest.jpg という名前のファイルをダウンロードします。

      ossutil cp oss://example-bucket/dest.jpg /tmp/ -e ep-bp1i****************.oss.cn-hangzhou.privatelink.aliyuncs.com --addressing-style path

      コマンドが正常に実行されると、以下のような出力が返され、ファイルがダウンロードされたことが示されます。/tmp ディレクトリにダウンロードされたファイルを確認できます。

      Success: Total 1 object, size 134102 B, Download done:(1 files, 134102 B), avg 680.112 KiB/s
      
      0.193189(s) elapsed

VPC アクセスのセキュリティ強化

PrivateLink の機能を検証した後、バケットポリシーを設定してセキュリティをさらに強化します。以下の例では、PrivateLink に関連付けられた VPC のみがファイルにアクセスできるように制限し、ネットワーク層およびアプリケーション層の両方でアクセス制御を実装する方法を示します。

  1. [バケット一覧] に移動し、対象のバケットをクリックします。

  2. 左側のナビゲーションウィンドウで、権限管理 > バケット承認ポリシー をクリックします。

  3. 新規権限 をクリックし、以下のパラメーターを設定します。その他のパラメーターはデフォルト値のままにしておいても問題ありません。

    • ユーザーすべてのアカウント (*) を選択します。

    • 許可された操作詳細設定 を選択します。

    • 効果拒否 を選択します。

    • 操作oss:GetObject を選択します。

    • 条件VPC ≠ を選択し、ドロップダウンリストから PrivateLink に関連付けられた VPC を選択します。

  4. OK をクリックしてバケットポリシーを保存します。

SSL-VPN 経由でのローカルデバイス接続

VPC にデプロイされた SSL-VPN ゲートウェイを使用すると、開発者のワークステーションやモバイルデバイスなどの個別のローカルデバイスを、迅速かつ柔軟にご利用の VPC に接続できます。デバイスが SSL-VPN を使用して暗号化トンネルを確立した後、設定済みの PrivateLink エンドポイント経由で OSS に安全にアクセスできます。このアプローチは、リモートワーク、開発・テスト、緊急アクセスなどのシナリオに適しています。

ステップ 1:SSL-VPN ゲートウェイの作成とクライアントの設定

SSL-VPN ゲートウェイをデプロイし、クライアントを設定して、ローカルデバイスと VPC 間に暗号化接続を確立します。詳細な手順については、「SSL-VPN 接続を使用して PC または Android クライアントを VPC に接続」をご参照ください。

ステップ 2:OSS へのプライベートアクセスの検証

接続テストを実行し、ファイルをダウンロードして、ローカルデバイスからの PrivateLink 接続が正常に機能していることを確認します。

  • 接続性の検証

    ping コマンドを使用してエンドポイントのドメイン名をテストし、DNS 解決およびネットワークパスが正常に動作していることを確認します。

    ping -c 4 ep-bp1i****************.oss.cn-hangzhou.privatelink.aliyuncs.com
  • ファイルダウンロードの検証

    ossutil

    ossutil を使用してファイル操作を実行し、PrivateLink 接続の機能を検証します。

    1. ossutil 2.0 をインストールおよび設定します。

    2. エンドポイントのドメイン名(例:ep-bp1i****************.oss.cn-hangzhou.privatelink.aliyuncs.com)を使用して OSS リソースにアクセスします。以下の例では、example-bucket という名前のバケットから dest.jpg という名前のファイルをダウンロードします。

      ossutil cp oss://example-bucket/dest.jpg /tmp/ -e ep-bp1i****************.oss.cn-hangzhou.privatelink.aliyuncs.com --addressing-style path

      コマンドが正常に実行されると、以下のような出力が返され、ファイルがダウンロードされたことが示されます。/tmp ディレクトリにダウンロードされたファイルを確認できます。

      Success: Total 1 object, size 134102 B, Download done:(1 files, 134102 B), avg 680.112 KiB/s
      
      0.193189(s) elapsed

    SDK

    SDK の使用は、複雑なビジネスロジックや例外処理を可能にするため、本番環境により代表的です。

    Java

    PrivateLink 経由で OSS にアクセスする際は、パススタイルアクセスを有効にするために setSLDEnabled(true) を呼び出します。パブリックインターネット経由でアクセスする場合は、このパラメーターを setSLDEnabled(false) に設定します。

    import com.aliyun.oss.*;
    import com.aliyun.oss.common.auth.*;
    import com.aliyun.oss.common.comm.SignVersion;
    import com.aliyun.oss.model.GetObjectRequest;
    import java.io.File;
    
    /**
     * OSS PrivateLink access example
     * Demonstrates how to access OSS and download a file by using PrivateLink.
     */
    public class Test {
    
        public static void main(String[] args) throws Exception {
            // The PrivateLink endpoint domain.
            String endpoint = "https://ep-bp1i****************.oss.cn-hangzhou.privatelink.aliyuncs.com";
    
            // Specify the region that corresponds to the endpoint. For example, cn-hangzhou.
            String region = "cn-hangzhou";
    
            // Obtain credentials from environment variables.
            // Before you run this sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are set.
            EnvironmentVariableCredentialsProvider credentialsProvider =
                    CredentialsProviderFactory.newEnvironmentVariableCredentialsProvider();
    
            // Specify the bucket name. For example, example-bucket.
            String bucketName = "example-bucket";
    
            // Specify the full path of the object. Do not include the bucket name in the full path.
            String objectName = "dest.jpg";
    
            // Specify the local path to save the downloaded file.
            String pathName = "dest.jpg";
    
            // Configure client parameters.
            ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration();
    
            // Enable path-style access for PrivateLink. Set this parameter to false for public internet access through the bucket's public domain name.
            clientBuilderConfiguration.setSLDEnabled(true);
    
            // Explicitly use Signature Version 4.
            clientBuilderConfiguration.setSignatureVersion(SignVersion.V4);
    
            // Create an OSS client instance.
            OSS ossClient = OSSClientBuilder.create()
                    .endpoint(endpoint)
                    .credentialsProvider(credentialsProvider)
                    .clientConfiguration(clientBuilderConfiguration)
                    .region(region)
                    .build();
    
            try {
                // Download the object to a local file.
                // If the specified local file exists, it is overwritten. If it does not exist, it is created.
                // If you do not specify a local path, the file is downloaded to the project's root directory.
                ossClient.getObject(new GetObjectRequest(bucketName, objectName), new File(pathName));
    
            } catch (OSSException oe) {
                // Handle OSS server-side exceptions.
                System.out.println("Caught an OSSException, which means your request made it to the OSS server, but was rejected with an error response.");
                System.out.println("Error Message: " + oe.getErrorMessage());
                System.out.println("Error Code: " + oe.getErrorCode());
                System.out.println("Request ID: " + oe.getRequestId());
                System.out.println("Host ID: " + oe.getHostId());
    
            } catch (ClientException ce) {
                // Handle client-side exceptions.
                System.out.println("Caught a ClientException, which means the client encountered a serious internal problem while trying to communicate with OSS, " +
                        "such as not being able to access the network.");
                System.out.println("Error Message: " + ce.getMessage());
    
            } finally {
                // Release resources.
                if (ossClient != null) {
                    ossClient.shutdown();
                }
            }
        }
    }

    Python

    PrivateLink 経由で OSS にアクセスする際は、パススタイルアクセスを有効にするために is_path_style=True を設定します。

    # -*- coding: utf-8 -*-
    """
    OSS PrivateLink access example
    This sample shows how to access OSS and download a file to a local path over a PrivateLink connection.
    """
    
    import oss2
    from oss2.credentials import EnvironmentVariableCredentialsProvider
    
    
    def main():
        """Main function: Demonstrates how to access OSS and download a file by using PrivateLink."""
        
        # Configure credentials.
        # An Alibaba Cloud account AccessKey pair has full permissions on all API operations. Using these credentials poses a high security risk.
        # We strongly recommend that you create and use a RAM user to call API operations or perform routine O&M.
        auth = oss2.ProviderAuth(EnvironmentVariableCredentialsProvider())
        
        # The PrivateLink endpoint domain.
        endpoint = 'https://ep-bp1i****************.oss.cn-hangzhou.privatelink.aliyuncs.com'
        
        # The bucket name.
        bucket_name = 'example-bucket'
        
        # Create a Bucket object.
        # Set is_path_style=True to enable path-style access, which is required for scenarios like PrivateLink.
        bucket = oss2.Bucket(auth, endpoint, bucket_name, is_path_style=True)
        
        # The path of the OSS object. Do not include the bucket name in the path.
        object_name = 'dest.jpg'
        
        # The local path to save the downloaded file.
        local_file_path = 'dest.jpg'
        
        # Download the object to a local file.
        # If the specified local file exists, it is overwritten. If it does not exist, it is created.
        bucket.get_object_to_file(object_name, local_file_path)
        
        print(f"File downloaded successfully: {object_name} -> {local_file_path}")
    
    
    if __name__ == '__main__':
        main()      

    Go

    PrivateLink 経由で OSS にアクセスする際は、パススタイルアクセスを有効にするために ForcePathStyle(true) を使用します。

    package main
    
    import (
    	"fmt"
    	"os"
    
    	"github.com/aliyun/aliyun-oss-go-sdk/oss"
    )
    
    const (
    	// The PrivateLink endpoint domain.
    	endpoint = "https://ep-bp1i****************.oss.cn-hangzhou.privatelink.aliyuncs.com"
    
    	// The bucket name.
    	bucketName = "example-bucket"
    
    	// The path of the OSS object. Do not include the bucket name in the path.
    	objectName = "dest.jpg"
    
    	// The local path to save the downloaded file.
    	localFilePath = "dest.jpg"
    )
    
    func main() {
    	// Initialize the credentials provider.
    	// Obtain credentials from environment variables.
    	// Before you run this sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are set.
    	provider, err := oss.NewEnvironmentVariableCredentialsProvider()
    	if err != nil {
    		fmt.Printf("Failed to initialize the credentials provider: %v\n", err)
    		os.Exit(-1)
    	}
    
    	// Create an OSS client instance.
    	// Use oss.ForcePathStyle(true) to enable path-style access, which is required for scenarios like PrivateLink.
    	client, err := oss.New(
    		endpoint,
    		"", // The AccessKey ID is obtained from the provider and can be left empty here.
    		"", // The AccessKey secret is obtained from the provider and can be left empty here.
    		oss.SetCredentialsProvider(&provider),
    		oss.ForcePathStyle(true),
    	)
    	if err != nil {
    		fmt.Printf("Failed to create the OSS client: %v\n", err)
    		os.Exit(-1)
    	}
    
    	// Obtain the bucket object.
    	bucket, err := client.Bucket(bucketName)
    	if err != nil {
    		fmt.Printf("Failed to obtain the bucket object: %v\n", err)
    		os.Exit(-1)
    	}
    
    	// Download the object to a local file.
    	// If the specified local file exists, it is overwritten. If it does not exist, it is created.
    	// If you do not specify a local path, the file is downloaded to the project's root directory.
    	err = bucket.GetObjectToFile(objectName, localFilePath)
    	if err != nil {
    		fmt.Printf("Failed to download the file: %v\n", err)
    		os.Exit(-1)
    	}
    
    	fmt.Printf("File downloaded successfully: %s -> %s\n", objectName, localFilePath)
    }
    

    C++

    PrivateLink 経由で OSS にアクセスする際は、パススタイルアクセスを有効にするために conf.isPathStyle = true を設定します。

    #include <alibabacloud/oss/OssClient.h>
    #include <memory>
    #include <fstream>
    #include <iostream>
    
    using namespace AlibabaCloud::OSS;
    
    int main(void)
    {
        // The PrivateLink endpoint domain.
        std::string Endpoint = "https://ep-bp1i****************.oss.cn-hangzhou.privatelink.aliyuncs.com";
        
        // The bucket name.
        std::string BucketName = "example-bucket";
        
        // The path of the OSS object. Do not include the bucket name in the path.
        std::string ObjectName = "dest.jpg";
        
        // The local path to save the downloaded file.
        // If the specified local file exists, it is overwritten. If it does not exist, it is created.
        // If you do not specify a local path, the file is downloaded to the project's root directory.
        std::string FileNametoSave = "dest.jpg";
    
        // Initialize OSS SDK resources.
        InitializeSdk();
    
        // Configure client parameters.
        ClientConfiguration conf;
        
        // Obtain credentials from environment variables.
        // Before you run this sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are set.
        auto credentialsProvider = std::make_shared<EnvironmentVariableCredentialsProvider>();
        
        // Enable path-style access, which is required for scenarios like PrivateLink.
        conf.isPathStyle = true;
        
        // Create an OSS client instance.
        OssClient client(Endpoint, credentialsProvider, conf);
    
        // Build a request to download the object.
        GetObjectRequest request(BucketName, ObjectName);
        
        // Set a response stream factory to create a local file stream.
        request.setResponseStreamFactory([=]() {
            return std::make_shared<std::fstream>(
                FileNametoSave, 
                std::ios_base::out | std::ios_base::in | std::ios_base::trunc | std::ios_base::binary
            );
        });
    
        // Execute the download operation.
        auto outcome = client.GetObject(request);
    
        // Handle the download result.
        if (outcome.isSuccess()) {
            std::cout << "File downloaded successfully. Size: " 
                      << outcome.result().Metadata().ContentLength() 
                      << " bytes" << std::endl;
            std::cout << "Saved to: " << FileNametoSave << std::endl;
        }
        else {
            // Handle errors.
            std::cout << "Download failed" << std::endl
                      << "Error code: " << outcome.error().Code() << std::endl
                      << "Error message: " << outcome.error().Message() << std::endl
                      << "Request ID: " << outcome.error().RequestId() << std::endl;
            
            // Release resources and return an error code.
            ShutdownSdk();
            return -1;
        }
    
        // Release OSS SDK resources.
        ShutdownSdk();
        return 0;
    }

Express Connect または VPN 経由でのデータセンター接続

エンタープライズデータセンターは、Express Connect 回線または VPN ゲートウェイを介して Alibaba Cloud VPC に接続し、その後 PrivateLink を使用してプライベートネットワーク経由で OSS にアクセスできます。Express Connect は安定したネットワークパフォーマンスと保証された帯域幅を提供し、VPN ゲートウェイは柔軟な暗号化接続を提供します。どちらのソリューションも、本番環境における大規模なデータ転送に適しています。詳細については、「VPC をオンプレミスデータセンターまたは他のクラウドに接続」をご参照ください。

本番環境

ベストプラクティス

  • セキュリティグループ構成の最適化

    セキュリティグループルールを最小権限の原則に基づいて設定します。必要な IP アドレス範囲に対してのみポートアクセスを許可し、定期的にセキュリティルールをレビューします。ソース IP およびポートに対する正確な制御により、不正アクセスや権限の拡散を防止し、ポリシーがビジネス要件に沿うようにします。

  • ネットワーク接続の監視

    VPC フローログを有効化し、トラフィックパターンを使用して異常を検出し、PrivateLink アクセス動作およびデータ転送をリアルタイムで監視します。

  • 複数の可用性ゾーンにわたるデプロイ

    本番環境では、高可用性およびディザスタリカバリのために、複数の可用性ゾーンにわたってエンドポイントをデプロイします。負荷分散または DNS ラウンドロビンを使用してトラフィックをインテリジェントに分散します。単一の可用性ゾーンが障害した場合、サービストラフィックは自動的に他の可用性ゾーンの正常なエンドポイントに切り替わり、サービス継続性および安定した運用を確保します。

課金

PrivateLink は、実際の使用量に基づき 1 時間単位で課金されます。料金にはインスタンス料金およびデータ転送料金が含まれます。サービス利用者とサービス提供者が異なる Alibaba Cloud アカウントになる場合があり、料金は指定されたアカウントに請求されます。詳細については、「課金概要」をご参照ください。