必見の記事

【新機能】Google Cloud 純正の構成図ツール Architecture Diagramming Tool が発表されました

Google Cloud のアーキテクチャ図を書く純正のツール Architecture Diagramming Tool が発表されました。Google Cloud の構成図ツールの決定版になると思います。

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

ウィスキー、シガー、パイプをこよなく愛する大栗です。

先程 Google Cloud 純正のアーキテクチャ図作成ツールである Google Cloud Architecture Diagramming Tool が発表されました。

Introducing a Google Cloud architecture diagramming tool

Google Cloud Architecture Diagramming Tool

今まではGoogle Slides のアイコン集が提供されていましたが、Google Slides はプレゼンテーションツールなのでアーキテクチャ図を作成するのは楽ではありませんでした。今回 Google Cloud 純正のアーキテクチャ図作成ツールが発表されて作成するのが簡単になっています。

ドキュメントなどを参照すると、Architecture Diagramming Tool は手書き風の図を作成できる事で人気の Excalidraw をベースに作成されているようです。

やってみる

実際に Google Cloud Architecture Diagramming Tool を触ってみます。

図を作成する

Architecture Diagramming Tool は https://googlecloudcheatsheet.withgoogle.com/architecture にあるのでブラウザで開いてみます。

Google Cloud Architecture Diagramming Tool

左上のメニューではアーキテクチャの保存やエクスポートが実施できます。collab button も付いていますが、現時点では動作していなそうです。

上中央のメニューでは、アイコン同士を接続するときに使用するノードや線の設定を行います。またライブラリの呼び出しもできます。

左にあるメニューがメインであるサービスのアイコンなどになります。アイコンをドラッグ・アンド・ドロップしてキャンバスに貼り付けます。

アイコンのカテゴリーには以下のものがあります。

  • Compute
  • Storage
  • Database
  • Data Analytics
  • AI/ML
  • Networking
  • DevOps CI/CD
  • Identity and Security
  • Management Tools
  • Application Integration
  • Gaming
  • Mobile (Firebase)
  • Workspace Platform
  • Google Maps Platform
  • Hybrid and Multi-cloud
  • API Platform and Ecosystems
  • Healthcare
  • Operations and Monitoring
  • Developer Tools
  • Retail
  • Migration to Google Cloud
  • Diagrams
  • Icons

ComputeカテゴリのCompute EngineNetworkingカテゴリのCloud Load Balancingをキャンバスに置いてみます。

上中央のメニューで Spoke を選んでアイコンを接続します。

左上のメニューから図の保存をします。PNG や SVG、クリップボードへの貼り付けができます。

PNG で保存すると以下の図のようになります。

構成済みアーキテクチャを呼び出す。

左のメニューでDiagramsを見ると、構成済みのリファレンスアーキテクチャが並んでいます。ここではContainer Appを選んでみます。

コンテナを使用したアプリケーションのリファレンスアーキテクチャが表示されます。

他にも多数の構成済みアーキテクチャがあります。

ワンクリックでデプロイ

ワンクリックでデプロイできるアーキテクチャ図も別途用意されています。現時点では、以下の2種類のようです。なお、ここでのデプロイは Architecture Diagramming Tool からリンクした先の Cloud Shell で GitHub のファイルを実行する機能によって実現されているようです。

2022年2月17日13:30 追記
Architecture Diagramming Tool としてはリンクしているだけで、デプロイは別途作成されたスクリプトで実行されている模様です。

各々のアーキテクチャ図を見てみましょう

Deploy a Compute Engine application behind Load Balancer

Cloud Load Balancer の背後に Compute Engine をデプロイしています。

Deploy a three tier application using Cloud Run, Cloud SQL, Memorystore and Cloud Build

Cloud Run で Nginx の Web Proxy と GO 言語で実装した API があり、データストアとして Cloud SQL for MySQL と Memorystore for Redis を使用しています。ビルドプロセスに Cloud Build を使っており、 Secret Manager からセンシティブなデータを取得しています。

実際にデプロイしてみる

Deploy a Compute Engine application behind Load Balancerを実際にデプロイしてみます。

図の下部にあるOPEN IN GOOGLE CLOUD SHELLをクリックします。

Cloud Shell で GitHub のファイルを実行するか確認されるので確認をクリックします。

Cloud Shell をプロビジョニングしています。

Cloud Shell がプロビジョニングされると、以下のように表示され./installを実行するように指示があります。

./installを実行します。

./install

プロジェクトを選択します。ここで新しくプロジェクトを作成する場合は1を入力します。新規でプロジェクトを作成することが推奨されています。

Choose a project to use for this application. 

NOTE:: This app will make changes to the project. 
While those changes are reverseable, it would be better to put it in a fresh new project.
 1) [CREATE NEW PROJECT]                           6) XXXXXXXX-6
 2) XXXXXXXX-2                                     7) XXXXXXXX-7
 3) XXXXXXXX-3                                     8) XXXXXXXX-8
 4) XXXXXXXX-4                                     9) XXXXXXXX-9
 5) XXXXXXXX-5                                    10) XXXXXXXX-10
Choose number, or just [enter] for [CREATE NEW PROJECT]
#? 1

新しくプロジェクトを作成する場合は、ここでプロジェクト名を入力します。ここではarchitecture-20220217と入力しました。

Creating the project
*************************************************************************************************************
Please enter a new project name to create: 
architecture-20220217

もし途中に以下のようなエラーメッセージが表示された場合は、対象プロジェクトの請求アカウントを設定してください。

ERROR: (gcloud.services.enable) FAILED_PRECONDITION: Billing account for project '1234567890123' is not found. Billing must be enabled for activation of service(s) 'compute.googleapis.com,compute.googleapis.com,compute.googleapis.com' to proceed.

以下のメッセージが表示された場合は、API が有効になるまで数分まってからyを入力します。

Polling for regions...
API [compute.googleapis.com] not enabled on project [1234567890123]. Would you like to enable and retry (this
 will take a few minutes)? (y/N)?  y

リージョンを選択します。ここではデフォルトのus-central1を選択したためそのまま決定しています。

Polling for regions...
Choose a valid region to use for this application. 
 1) asia-east1                                    16) europe-west3
 2) asia-east2                                    17) europe-west4
 3) asia-northeast1                               18) europe-west6
 4) asia-northeast2                               19) northamerica-northeast1
 5) asia-northeast3                               20) northamerica-northeast2
 6) asia-south1                                   21) southamerica-east1
 7) asia-south2                                   22) southamerica-west1
 8) asia-southeast1                               23) us-central1 - (current)
 9) asia-southeast2                               24) us-east1
10) australia-southeast1                          25) us-east4
11) australia-southeast2                          26) us-west1
12) europe-central2                               27) us-west2
13) europe-north1                                 28) us-west3
14) europe-west1                                  29) us-west4
15) europe-west2
Choose number, or just [enter] for us-central1
#?

ゾーンを選択します。ここではデフォルトのus-central1-aを選択したためそのまま決定しています。

Polling for zones...
Choose a valid zone to use for this application. 
 1) us-central1-a - (current)                      3) us-central1-c
 2) us-central1-b                                  4) us-central1-f
Choose number, or just [enter] for us-central1-a
#?

起動する仮想マシンの台数を入力します。ここではデフォルトの3を選択したためそのまま決定しています。

Enter the number of VMs to populate the Managed Instance Group [leave blank for '3']:

最後にCONGRATS!!!!!!!と表示されて GCLB のアクセス先が表示されます。

*************************************************************************************************************
CONGRATS!!!!!!!
You have configured a project, spun up architecture and deployed code.
See your site at:

http://203.0.113.155

*************************************************************************************************************

実際にブラウザでアクセスしてみると以下のように表示されます。

さいごに

Google Cloud のアーキテクチャ図を作成するツールはサードパーティ含めいくつもありますが、Google Cloud 純正で出てきており決定版と言えるのではないでしょうか?今後 Google Cloud での構成を図に起こす場合はこちらを利用すると良いかと思います。

先日 Google Cloud のチートシートも最新版も発表されたので、合わせて利用するとスムーズにアーキテクチャを構成出来るようになると思います。

version 2 of the Google Cloud Cheat Sheet for developers