LoginSignup
0
3

More than 3 years have passed since last update.

aws構成図を作成するため graphviz + diagrams の vscode の環境を chocolateyで30分ぐらいで作る

Last updated at Posted at 2020-09-10

はじめに

AWSのシステム構成図を書くのにdiagramsといういいツールがあるというので環境作成した時のメモです
30分ぐらいでできます。

環境

windows10 pro

順番

  1. chocolatey インストール
  2. graphviz インストール
  3. python インストール
  4. diagrams インストール
  5. vscode インストール

1. chocolatey インストール

powerShell を管理者モードで起動します
(スタートメニューの上で右クリック)

Get-ExecutionPolicyAllSigned にします

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\Users\lunar> Get-ExecutionPolicy
Restricted

(↑ Restricted なので、AllSigned に設定します)

PS C:\Users\lunar> Set-ExecutionPolicy AllSigned

実行ポリシーの変更
実行ポリシーは、信頼されていないスクリプトからの保護に役立ちます。実行ポリシーを変更すると、about_Execution_Policies
のヘルプ トピック (https://go.microsoft.com/fwlink/?LinkID=135170)
で説明されているセキュリティ上の危険にさらされる可能性があります。実行ポリシーを変更しますか?
[Y] はい(Y)  [A] すべて続行(A)  [N] いいえ(N)  [L] すべて無視(L)  [S] 中断(S)  [?] ヘルプ (既定値は "N"):A
PS C:\Users\lunar> Get-ExecutionPolicy
AllSigned
PS C:\Users\lunar>

chocolateyをインストールします

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

おわり

2. graphviz インストール

powerShell で実行します

choco install graphviz -y

おわり

3. python インストール

powerShell で実行します

choco install python -y

commandプロンプトを起動して確認します

Win + r で cmd と入力してエンター

>python --version
Python 3.8.5

おわり

4. diagrams インストール

commandプロンプトで実行します。

pip install diagrams

おわり

5. vscode インストール

powerShell で実行します

choco install vscode -y

5.1 settingsでpythonのpathを設定する

※ 個々の環境に合わせます。choco で何も指定せずにインストールしていたら下記になります。

{
    "python.defaultInterpreterPath": "C:\\Python38\\python.exe",
}

5.2 エクステンションを追加する

下記の Python extension for Visual Studio Code を追加します。
https://marketplace.visualstudio.com/items?itemName=ms-python.python

おわり

動作確認

クラスメソッドさんの記事のコードを使います

Diagramsを使ってPythonでシステム構成図を描く
https://dev.classmethod.jp/articles/diagrams-introduction/

vscodeを起動して上記の sample.py をコピペして実行すると下記ができました

image.png

以上で完了です。

0
3
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
0
3