1. はじめに
オンプレミスやPower Systems Virtual ServerからIBM Cloud上のICOS(IBM Cloud Object Storage)にDirect Link経由でアクセスしたいという需要は多くあります。しかし、ICOSはIBM Cloud上のサービスネットワーク上に存在し、そのサービスネットワークへの経路はBGPでオンプレミスやPower Systems Virtual Serverに広告されません。結果、Reverse Proxyで中継することでICOSにアクセスを行う方法が挙げられていました。ただし、このやり方はProxy Serverを利用者自身で構築・運用する必要があります。
Service Networkにアクセスするために、Reverse Proxyを構築する代わりにNATを利用することも可能です。ただし、ICOSのIPアドレスが明示的に公開されているわけではないので、IPアドレスが変更された場合にNATの設定も変更する必要があるという考慮点があります。
https://cloud.ibm.com/docs/direct-link?topic=direct-link-using-ibm-cloud-direct-link-to-connect-to-ibm-cloud-object-storage
VPCには、IBM CloudのサービスをVPC内部の自身のIPアドレス経由で利用可能とするVPE(Virtual Private Endpoint)という機能があります。VPC内部のIPアドレスであれば、Direct Link経由で直接アクセス出来そうなものですが、残念ながら本記事執筆時点ではVPEにはDirect Link経由で直接アクセスできないという制限が存在します(近い将来改善予定です)。
ただし、VPEの前段にALB(Application Load Balancer)を配置し、ALBの割り振り先としてVPEを選択すればICOSにアクセスすることが可能になります。本記事ではこのやり方をStep by Stepで検証したいと思います。
VPCにアクセスする必要があるため、Direct Link 2.0が必要になります。またALBはデータ転送量に応じて課金が発生するため、データ量によっては従来のReverse Proxy形式の方が安価になる可能性があります。
https://www.ibm.com/cloud/vpc/pricing
また、ALB自身の性能がボトルネックになる可能性があります。ALBにはHorizontal scalingの機能がありますが、1つのICOS Clientで利用できるALBのIPは1つのままでしょうから、別端末からアクセスしない限りはHorizontal scalingは性能向上には寄与しないでしょう。
参考情報
https://cloud.ibm.com/docs/vpc?topic=vpc-end-to-end-private-connectivity&interface=cli
2. 前提
- VPC及び、VPE用のsubnetやALB用のsubnetを作成済みであること。
- 1つのsubnetで構成することも可能ですが、複数に分けておくことでSecurity Groupを個別に設定することができます。
- ICOSが既にセットアップされており、bucket作成済みであること。
- Direct Link 2.0でオンプレミスもしくはPower Systems Virtual ServerがVPCと接続されていること。本記事では、Power Systems Virtual Server(AIX)を利用。
- ICOSにアクセスするクライアントツールが導入・設定済みであること(今回はawscliを利用)
3. ICOSに対するVPEを作成
- Create
- 名前およびリージョンを選択
- Direct Link接続済みでVPEを作成するVPC、Cloud Object Storage、及び適切なendpointを指定。今回は東京リージョンのRegionalのICOSを指定したいため、
s3.direct.jp-tok.cloud-object-storage.appdomain.cloud
を指定する。
s3.direct.jp-tok.cloud-object-storage.appdomain.cloudがRegional環境でのTokyo用Endpointです。
s3.direct.tok.ap.cloud-object-storage.appdomain.cloudはCross Region環境でのTokyo用Endpointです。紛らわしいですが、間違って選択しないようにしましょう。
これで作成すると、VPEアドレスとして、10.1.0.11が割り当てられました。
4. VPEに対するアクセス確認(VPC内のVSIから)
-
--endpoint-url
によってEndpointを明示的に指定する。 -
--no-verify-ssl
を使うことで証明書の検証をSkipする。
(python368) [root@myvpc ~]# aws --endpoint-url https://10.1.0.11 --no-verify-ssl s3 ls
/root/python368/lib64/python3.6/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host '10.1.0.11'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
2019-04-11 13:14:02 mybucket104
2019-06-27 09:00:19 mybucket105
2019-10-02 11:39:06 mybucket106
2020-06-20 15:49:17 mybucket107
(python368) [root@myvpc ~]# aws --endpoint-url https://10.1.0.11 --no-verify-ssl s3 ls mybucket105
/root/python368/lib64/python3.6/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host '10.1.0.11'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
2021-09-03 09:03:41 196283 test.txt
5. ALB(Application Load Balancer)の作成
- Create
- Application Load Balancerを選択
- 対象のリージョン、VPCを選択。Direct Linkからのアクセスなので、
Private
タイプを選択。
- Backend poolの作成。Protocolは
TCP
を選択。
Back-end poolのメンバーはUIからはVPEを指定できません。また、Front-end listenersは後で作成するので、これで注文します。
6. ALBにBackend MemberとしてVPEを登録
$ ibmcloud is load-balancers
Listing load balancers in all resource groups and region jp-tok under account xxx as user xxxxxxx@xx.xxx.xxx...
ID Name Family Subnets Is public Provision status Operating status Resource group
r022-21e91dc6-62f5-44db-979c-cace0d1819ce alb-icos-tokyo-regional Application sub-10-5-0-0-24 false active online Default
(以下省略)
$ ibmcloud is load-balancer-pools r022-21e91dc6-62f5-44db-979c-cace0d1819ce
Listing pools of load balancer r022-21e91dc6-62f5-44db-979c-cace0d1819ce under account xxx as user xxxxxxx@xx.xxx.xxx...
ID Name Algorithm Protocol Type Provision status Instance group Proxy protocol
r022-5b328f49-4982-4dc5-b083-f62f4fecabde icospool round_robin tcp - active - disabled
$ ibmcloud is load-balancer-pool-member-create r022-21e91dc6-62f5-44db-979c-cace0d1819ce r022-5b328f49-4982-4dc5-b083-f62f4fecabde 443 10.1.0.11 --weight 60
Creating member of pool r022-5b328f49-4982-4dc5-b083-f62f4fecabde under account xxx as user xxxxxxx@xx.xxx.xxx...
ID r022-862ff4c5-8627-4f30-810c-4923c1762c40
Port 443
Target 10.1.0.11
Weight 60
Health unknown
Created 2021-09-02T10:43:38.484+09:00
Provision status create_pending
backend poolのメンバーへのVPEの登録はCLI/API経由でしか行えませんが、登録されたVPE自体はCustomer Portalからも確認できます。しばらく待っていると、Health StatusもPassing
になります。
7. ALBにFrontend Listenerを作成
これで全ての作業は完了です。
8. ALBに対するアクセス確認(VPC内のVSIから)
(python368) [root@myvpc ~]# aws --endpoint-url https://21e91dc6-jp-tok.lb.appdomain.cloud --no-verify-ssl s3 ls
/root/python368/lib64/python3.6/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host '21e91dc6-jp-tok.lb.appdomain.cloud'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
2019-04-11 13:14:02 mybucket104
2019-06-27 09:00:19 mybucket105
2019-10-02 11:39:06 mybucket106
2020-06-20 15:49:17 mybucket107
(python368) [root@myvpc ~]# aws --endpoint-url https://21e91dc6-jp-tok.lb.appdomain.cloud --no-verify-ssl s3 ls mybucket105
/root/python368/lib64/python3.6/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host '21e91dc6-jp-tok.lb.appdomain.cloud'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
2021-09-03 09:03:41 196283 test.txt
9. Direct Link越しでテスト
今回は、Power Systems Virtual Server上のAIXからアクセスします。
(python3710) # oslevel
7.2.0.0
(python3710) # aws --endpoint-url https://21e91dc6-jp-tok.lb.appdomain.cloud --no-verify-ssl s3 ls
/python3710/lib64/python3.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host '21e91dc6-jp-tok.lb.appdomain.cloud'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
2019-04-11 13:14:02 mybucket104
2019-06-27 09:00:19 mybucket105
2019-10-02 11:39:06 mybucket106
2020-06-20 15:49:17 mybucket107
(python3710) # aws --endpoint-url https://21e91dc6-jp-tok.lb.appdomain.cloud --no-verify-ssl s3 ls mybucket105
/python3710/lib64/python3.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host '21e91dc6-jp-tok.lb.appdomain.cloud'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
2021-09-03 09:03:41 196283 test.txt
10. おまけ(FQDNのカスタマイズ)
DNSでCNAMEの構成をしておけば、好きなFQDNでICOSにアクセスできる。
例えば、mydomain.local
というドメインを所有しており、icos.mydomain.local
-> 21e91dc6-jp-tok.lb.appdomain.cloud
となるようなCNAME設定をしておけば、以下のように自分の所持しているドメイン配下のFQDNでICOSにアクセス可能になる。
(python3710) # aws --endpoint-url https://icos.mydomain.local --no-verify-ssl s3 ls
/python3710/lib64/python3.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'icos.mydomain.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
2019-04-11 13:14:02 mybucket104
2019-06-27 09:00:19 mybucket105
2019-10-02 11:39:06 mybucket106
2020-06-20 15:49:17 mybucket107
(python3710) # aws --endpoint-url https://icos.mydomain.local --no-verify-ssl s3 ls mybucket105
/python3710/lib64/python3.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'icos.mydomain.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
2021-09-03 09:03:41 196283 test.txt