2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ロード・バランサ経由でオブジェクト・ストレージのプライベート・エンドポイントにアクセスする

Posted at

あまり実施することはない構成だと思われるのでそんなに実用的ではありませんが、少し特殊な要件があったため以下の確認を行った時の記録です。

確認したいこと

  • FLBのバックエンドにオブジェクト・ストレージのプライベート・エンドポイントを配置して、FLB経由でオブジェクトにアクセスができるかどうか。
  • IPアドレスとしてはクライアントからFLBのIPアドレスを指定すればネットワークの疎通自体はできそうだが、オブジェクト・ストレージにHTTPSリクエストを行う際には正しいオブジェクト・ストレージのFQDN宛てである必要があるので、今回はクライアント側の /etc/hosts を使って、プライベート・エンドポイントのFQDNをロードバランサーのIPアドレスに名前解決するように記載した。
    image-20251112101217525.png

環境

  • パブリックサブネットに置いているインスタンスを利用する。
    image-20250717134048435.png

  • プライベート・サブネット内にオブジェクト・ストレージのプライベート・エンドポイントを作成済み。image-20250717140532746.png

    • インスタンスからはVCNのデフォルトのプライベートDNSを参照しているので、ここで設定されているFQDNはプライベートIPアドレスに名前解決されることを確認。

      [opc@tk-inst-ol8 ~ 2025-07-17T04:34:01]$
      [opc@tk-inst-ol8 ~ 2025-07-17T04:34:09]$dig tkpe-orasejapan.private.objectstorage.ap-tokyo-1.oci.customer-oci.com
      
      ; <<>> DiG 9.11.36-RedHat-9.11.36-16.el8_10.2 <<>> tkpe-orasejapan.private.objectstorage.ap-tokyo-1.oci.customer-oci.com
      ;; global options: +cmd
      ;; Got answer:
      ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54126
      ;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
      
      ;; OPT PSEUDOSECTION:
      ; EDNS: version: 0, flags:; udp: 4096
      ;; QUESTION SECTION:
      ;tkpe-orasejapan.private.objectstorage.ap-tokyo-1.oci.customer-oci.com. IN A
      
      ;; ANSWER SECTION:
      tkpe-orasejapan.private.objectstorage.ap-tokyo-1.oci.customer-oci.com. 454 IN A 10.2.1.219
      
      ;; Query time: 0 msec
      ;; SERVER: 169.254.169.254#53(169.254.169.254)
      ;; WHEN: Thu Jul 17 04:34:13 GMT 2025
      ;; MSG SIZE  rcvd: 114
      
      [opc@tk-inst-ol8 ~ 2025-07-17T04:34:13]$
      

PARの動作確認(通常)

  1. まずは、インスタンスからcurlコマンドで通常のPARにアクセスし、プライベート・エンドポイントでもパブリック・エンドポイントでも問題なくアクセスできることを確認する。

    • パブリック・エンドポイント経由のPARの形式

      • https://objectstorage.ap-tokyo-1.oraclecloud.com/p/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/n/<ネームスペース>/b/<バケット名>/o/<オブジェクト名>
        
    • プライベート・エンドポイント経由のPARの形式

      • https://<接頭辞>-<ネームスペース>.private.objectstorage.ap-tokyo-1.oci.customer-oci.com/p/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/n/<namespace>/b/<バケット名>/o/<オブジェクト名>
        
  2. バケット内にテキストファイルを配置して、問題なくどちらのPARでも参照できることを確認。

    • [opc@tk-inst-ol8 ~ 2025-07-17T04:49:19]$curl -i https://objectstorage.ap-tokyo-1.oraclecloud.com/p/P-CjWzpDqtzYZ17pzyKeyE5U3acxsaPCHG0DsFZif0nMJ31-Lq4WKTSzde_CzU4m/n/orasejapan/b/tk_test_bucket/o/testfile_01.txt
      HTTP/1.1 200 OK
      accept-ranges: bytes
      Content-Length: 18
      content-md5: ytn5gztYvPJkpn/w4EjOvw==
      last-modified: Thu, 17 Jul 2025 04:48:46 GMT
      etag: 8b094d23-6043-4d08-a4c3-9e5a4d67766f
      version-id: 85c22cf2-dad7-448d-ae15-0cffb3110b73
      storage-tier: Standard
      Content-Type: text/plain
      date: Thu, 17 Jul 2025 04:49:22 GMT
      opc-request-id: nrt-1:QR5ILN66La4QZxZCgWNq2Aj2kIS6AESqDK8M0X2BAPZxPKl_Tw5-7jP5k1rsVR02
      x-api-id: native
      x-content-type-options: nosniff
      strict-transport-security: max-age=31536000; includeSubDomains
      access-control-allow-origin: *
      access-control-allow-methods: POST,PUT,GET,HEAD,DELETE,OPTIONS
      access-control-allow-credentials: true
      access-control-expose-headers: accept-ranges,access-control-allow-credentials,access-control-allow-methods,access-control-allow-origin,content-length,content-md5,content-type,date,etag,last-modified,opc-client-info,opc-request-id,storage-tier,strict-transport-security,version-id,x-api-id,x-content-type-options
      
      
      
      hogehoge
      
      
      [opc@tk-inst-ol8 ~ 2025-07-17T04:49:22]$
      [opc@tk-inst-ol8 ~ 2025-07-17T04:49:27]$
      [opc@tk-inst-ol8 ~ 2025-07-17T04:49:28]$
      [opc@tk-inst-ol8 ~ 2025-07-17T04:49:35]$curl -i https://tkpe-orasejapan.private.objectstorage.ap-tokyo-1.oci.customer-oci.com/p/P-CjWzpDqtzYZ17pzyKeyE5U3acxsaPCHG0DsFZif0nMJ31-Lq4WKTSzde_CzU4m/n/orasejapan/b/tk_test_bucket/o/testfile_01.txt
      HTTP/1.1 200 OK
      accept-ranges: bytes
      Content-Length: 18
      content-md5: ytn5gztYvPJkpn/w4EjOvw==
      last-modified: Thu, 17 Jul 2025 04:48:46 GMT
      etag: 8b094d23-6043-4d08-a4c3-9e5a4d67766f
      version-id: 85c22cf2-dad7-448d-ae15-0cffb3110b73
      storage-tier: Standard
      Content-Type: text/plain
      date: Thu, 17 Jul 2025 04:49:35 GMT
      opc-request-id: nrt-1:3QnfUl4PlDyZWxF4Lyo08KPzKn-UcnaNrWzSnZyoG6QYsfOCQYbRAgn7-s6AKGGv
      x-api-id: native
      x-content-type-options: nosniff
      strict-transport-security: max-age=31536000; includeSubDomains
      access-control-allow-origin: *
      access-control-allow-methods: POST,PUT,GET,HEAD,DELETE,OPTIONS
      access-control-allow-credentials: true
      access-control-expose-headers: accept-ranges,access-control-allow-credentials,access-control-allow-methods,access-control-allow-origin,content-length,content-md5,content-type,date,etag,last-modified,opc-client-info,opc-request-id,storage-tier,strict-transport-security,version-id,x-api-id,x-content-type-options
      
      
      
      hogehoge
      
      [opc@tk-inst-ol8 ~ 2025-07-17T04:49:35]$
      [opc@tk-inst-ol8 ~ 2025-07-17T04:49:35]$
      

FLBのバックエンドにプライベート・エンドポイントを配置する

続いて、FLBのバックエンドとして上記で確認したオブジェクト・ストレージのプライベート・エンドポイントを配置していきます。

  1. FLBはあらかじめ作成してあるパブリック・ロードバランサーを使用します。image-20250717133647397.png

  2. SSLパススルー(=SSLトンネリング。FLBでSSLを終端しないパターンのHTTPS。)のため、TCP 443番のリスナーを作成。image-20250717133719823.png

  3. SSLパススルーなのでバックエンド・セットもSSL無効にする。バックエンドにはプライベート・エンドポイントのIPアドレスと443ポートを指定。image-20250717133835800.png

  4. FLBを配置しているパブリック・サブネットのセキュリティ・リストを確認。クライアントからFLBへのHTTPS通信のため、イングレスのport 443を許可しておく。image-20250717142120133.png

  5. これでFLB側の設定は完了。

  6. 続いて、インスタンスのOS上で/etc/hostsを編集。プライベート・エンドポイントのFQDNをロードバランサーのパブリックIPに名前解決させる。

    [opc@tk-inst-ol8 ~ 2025-07-17T04:54:29]$sudo vi /etc/hosts
    [opc@tk-inst-ol8 ~ 2025-07-17T04:54:48]$
    [opc@tk-inst-ol8 ~ 2025-07-17T04:54:49]$cat /etc/hosts
    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    10.2.0.125 tk-inst-ol8.sub01090522420.tktokyovnc2.oraclevcn.com tk-inst-ol8
    
    141.147.173.63 tkpe-orasejapan.private.objectstorage.ap-tokyo-1.oci.customer-oci.com
    [opc@tk-inst-ol8 ~ 2025-07-17T04:54:52]$
    
  7. 先ほどと同じくプライベート・エンドポイントのPARで取得できた。

    [opc@tk-inst-ol8 ~ 2025-07-17T04:58:11]$
    [opc@tk-inst-ol8 ~ 2025-07-17T04:58:11]$curl -i https://tkpe-orasejapan.private.objectstorage.ap-tokyo-1.oci.customer-oci.com/p/P-CjWzpDqtzYZ17pzyKeyE5U3acxsaPCHG0DsFZif0nMJ31-Lq4WKTSzde_CzU4m/n/orasejapan/b/tk_test_bucket/o/testfile_01.txt
    HTTP/1.1 200 OK
    accept-ranges: bytes
    Content-Length: 18
    content-md5: ytn5gztYvPJkpn/w4EjOvw==
    last-modified: Thu, 17 Jul 2025 04:48:46 GMT
    etag: 8b094d23-6043-4d08-a4c3-9e5a4d67766f
    version-id: 85c22cf2-dad7-448d-ae15-0cffb3110b73
    storage-tier: Standard
    Content-Type: text/plain
    date: Thu, 17 Jul 2025 05:20:07 GMT
    opc-request-id: nrt-1:5Av7VmXVpw00UVMr5QfUA6lR4-jpRXJxlp6yi6PNjjeVK0OT_NCpIhAUbl-_XGf2
    x-api-id: native
    x-content-type-options: nosniff
    strict-transport-security: max-age=31536000; includeSubDomains
    access-control-allow-origin: *
    access-control-allow-methods: POST,PUT,GET,HEAD,DELETE,OPTIONS
    access-control-allow-credentials: true
    access-control-expose-headers: accept-ranges,access-control-allow-credentials,access-control-allow-methods,access-control-allow-origin,content-length,content-md5,content-type,date,etag,last-modified,opc-client-info,opc-request-id,storage-tier,strict-transport-security,version-id,x-api-id,x-content-type-options
    
    
    
    hogehoge
    
    [opc@tk-inst-ol8 ~ 2025-07-17T05:20:07]$
    

FLBを経由してオブジェクト・ストレージのプライベート・エンドポイントのPARにアクセスできることが確認できました。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?