はじめに
既に構築されたシステムだけどAWSの構成図がないというときに調査をしてAWS構成図を手書きするということが良くあった。
それをAmazon Q Developer
を使って自動で生成できるというポストを見たので、これを実践してみる。
環境
Amazon Q Developer
Visual Studio Code 1.98.2
WSL2 Ubuntu 24.04
準備
- コマンドライン用の Amazon Q をインストールする
https://docs.aws.amazon.com/ja_jp/amazonq/latest/qdeveloper-ug/command-line-installing.html
※VSCode
の方はソフトウェア開発用の拡張とのこと
- Amazon Q Developer
https://aws.amazon.com/jp/q/developer/
CLIのインストール
- debパッケージ用のAmazon Qをダウンロードする。
curl --proto '=https' --tlsv1.2 -sSf https://desktop-release.q.us-east-1.amazonaws.com/latest/amazon-q.deb -o amazon-q.deb
apt
コマンドを使用してインストールする。
sudo apt install -y ./amazon-q.deb
ログ
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'amazon-q' instead of './amazon-q.deb'
The following packages were automatically installed and are no longer required:
libgl1-amber-dri libllvm19 libxcb-damage0 mesa-utils-bin xbitmaps
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
amazon-q
0 upgraded, 1 newly installed, 0 to remove and 54 not upgraded.
Need to get 0 B/168 MB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 /home/kbushi/workspace/terraform/aws-alb-ec2-with-terra-form/amazon-q.deb amazon-q amd64 1.7.1 [168 MB]
Selecting previously unselected package amazon-q.
(Reading database ... 120197 files and directories currently installed.)
Preparing to unpack .../amazon-q.deb ...
Unpacking amazon-q (1.7.1) ...
Setting up amazon-q (1.7.1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1.1ubuntu3) ...
Processing triggers for desktop-file-utils (0.27-2build1) ...
q
コマンドで実行を確認する
q
q (Amazon Q CLI)
Popular Subcommands Usage: q [subcommand]
╭────────────────────────────────────────────────────╮
│ chat Chat with Amazon Q │
│ translate Natural Language to Shell translation │
│ doctor Debug installation issues │
│ settings Customize appearance & behavior │
│ quit Quit the app │
╰────────────────────────────────────────────────────╯
To see all subcommands, use:
❯ q --help-all
q login
でログインをする
q login
Use for Free with Builder ID
を選択する。
Open this URL:
で出力されたURLを開き、ログイン+許可を行う。Logged in successfully
となればOK
構成図を作るためのAWSリソースを作成
※既に調査したいAWSリソースがあるのであれば不要
今回は、以下の記事で使用した構成を構築し、Amazon Q Developer
でdraw.io
の構成図を出力させてみる。
というわけで構築を行った。
Amazon Q Developer (CLI)を使う
構成図を作成する
q chat
で新しいチャットを開始する。
q chat
- 以下のプロンプトを入力する。
AWS CLIの terraformのプロファイルを使用してVPCのリソースを調査してdraw.ioの構成図をSVG形式で出力して
結果
> AWS CLIの terraformのプロファイルを使用してVPCのリソースを調査してdraw.ioの構成図をSVG形式で出力して
AWS CLIでterraformプロファイルを使用してVPCリソースを調査し、draw.ioの構成図をSVG形式で出力するために、以下
の手順で進めていきます。
まず、terraformプロファイルを使用してVPCリソースを調査しましょう。
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-vpcs
Profile name: terraform
Region: us-east-1
Label: List VPCs using terraform profile
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 1.678s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-subnets
Profile name: terraform
Region: us-east-1
Label: List subnets using terraform profile
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 1.542s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-internet-gateways
Profile name: terraform
Region: us-east-1
Label: List internet gateways using terraform profile
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 1.473s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-route-tables
Profile name: terraform
Region: us-east-1
Label: List route tables using terraform profile
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 1.443s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-security-groups
Profile name: terraform
Region: us-east-1
Label: List security groups using terraform profile
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 1.466s
Write to filesystem
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Path: /home/kbushi/workspace/terraform/aws_vpc_diagram.drawio
+ 1: <mxfile host="app.diagrams.net" modified="2025-03-16T10:12:27.000Z" agent="Amazon Q" etag="diagram_etag" version="21.7.5" type="device">
+ 2: <diagram id="AWS-VPC-Architecture" name="AWS VPC Architecture">
+ 3: <mxGraphModel dx="1422" dy="762" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="850" background="#ffffff" math="0" shadow="0">
+ 4: <root>
+ 5: <mxCell id="0" />
+ 6: <mxCell id="1" parent="0" />
+ 7: <!-- AWS Cloud -->
+ 8: <mxCell id="cloud" value="AWS Cloud" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_aws_cloud;strokeColor=#232F3E;fillColor=none;verticalAlign=top;align=left;spacingLeft=30;fontColor=#232F3E;dashed=0;" parent="1" vertex="1">
+ 9: <mxGeometry x="50" y="50" width="1000" height="700" as="geometry" />
+ 10: </mxCell>
+ 11: <!-- Region -->
+ 12: <mxCell id="region" value="Region: us-east-1" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_region;strokeColor=#147EBA;fillColor=none;verticalAlign=top;align=left;spacingLeft=30;fontColor=#147EBA;dashed=1;" parent="cloud" vertex="1">
+ 13: <mxGeometry x="50" y="40" width="900" height="630" as="geometry" />
+ 14: </mxCell>
+ 15: <!-- VPC -->
+ 16: <mxCell id="vpc" value="VPC: vpc-e71f1f9f
CIDR: 172.31.0.0/16" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_vpc;strokeColor=#248814;fillColor=none;verticalAlign=top;align=left;spacingLeft=30;fontColor=#AAB7B8;dashed=0;" parent="region" vertex="1">
+ 17: <mxGeometry x="50" y="40" width="800" height="560" as="geometry" />
+ 18: </mxCell>
+ 19:
+ 20: <!-- Internet Gateway -->
+ 21: <mxCell id="igw" value="Internet Gateway
igw-aca290d5" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.internet_gateway;fillColor=#F58534;gradientColor=none;" parent="vpc" vertex="1">
+ 22: <mxGeometry x="375" y="-20" width="50" height="50" as="geometry" />
+ 23: </mxCell>
+ 24:
+ 25: <!-- Public Subnets -->
+ 26: <mxCell id="public_subnet_group" value="Public Subnets" style="fillColor=none;strokeColor=#147EBA;dashed=1;verticalAlign=top;fontStyle=0;fontColor=#147EBA;" parent="vpc" vertex="1">
+ 27: <mxGeometry x="50" y="60" width="700" height="240" as="geometry" />
+ 28: </mxCell>
+ 29:
+ 30: <mxCell id="subnet_1a" value="Subnet: subnet-782d731c
AZ: us-east-1a
CIDR: 172.31.0.0/20" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_security_group;grStroke=0;strokeColor=#248814;fillColor=#E9F3E6;verticalAlign=top;align=left;spacingLeft=30;fontColor=#248814;dashed=0;" parent="vpc" vertex="1">
+ 31: <mxGeometry x="70" y="100" width="200" height="80" as="geometry" />
+ 32: </mxCell>
+ 33:
+ 34: <mxCell id="subnet_1b" value="Subnet: subnet-36b1d619
AZ: us-east-1b
CIDR: 172.31.80.0/20" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_security_group;grStroke=0;strokeColor=#248814;fillColor=#E9F3E6;verticalAlign=top;align=left;spacingLeft=30;fontColor=#248814;dashed=0;" parent="vpc" vertex="1">
+ 35: <mxGeometry x="300" y="100" width="200" height="80" as="geometry" />
+ 36: </mxCell>
+ 37:
+ 38: <mxCell id="subnet_1c" value="Subnet: subnet-c3476b88
AZ: us-east-1c
CIDR: 172.31.16.0/20" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_security_group;grStroke=0;strokeColor=#248814;fillColor=#E9F3E6;verticalAlign=top;align=left;spacingLeft=30;fontColor=#248814;dashed=0;" parent="vpc" vertex="1">
+ 39: <mxGeometry x="530" y="100" width="200" height="80" as="geometry" />
+ 40: </mxCell>
+ 41:
+ 42: <mxCell id="subnet_1d" value="Subnet: subnet-5c821901
AZ: us-east-1d
CIDR: 172.31.32.0/20" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_security_group;grStroke=0;strokeColor=#248814;fillColor=#E9F3E6;verticalAlign=top;align=left;spacingLeft=30;fontColor=#248814;dashed=0;" parent="vpc" vertex="1">
+ 43: <mxGeometry x="70" y="200" width="200" height="80" as="geometry" />
+ 44: </mxCell>
+ 45:
+ 46: <mxCell id="subnet_1e" value="Subnet: subnet-bb552084
AZ: us-east-1e
CIDR: 172.31.64.0/20" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_security_group;grStroke=0;strokeColor=#248814;fillColor=#E9F3E6;verticalAlign=top;align=left;spacingLeft=30;fontColor=#248814;dashed=0;" parent="vpc" vertex="1">
+ 47: <mxGeometry x="300" y="200" width="200" height="80" as="geometry" />
+ 48: </mxCell>
+ 49:
+ 50: <mxCell id="subnet_1f" value="Subnet: subnet-8061908f
AZ: us-east-1f
CIDR: 172.31.48.0/20" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_security_group;grStroke=0;strokeColor=#248814;fillColor=#E9F3E6;verticalAlign=top;align=left;spacingLeft=30;fontColor=#248814;dashed=0;" parent="vpc" vertex="1">
+ 51: <mxGeometry x="530" y="200" width="200" height="80" as="geometry" />
+ 52: </mxCell>
+ 53:
+ 54: <!-- Private Subnet -->
+ 55: <mxCell id="private_subnet_group" value="Private Subnet" style="fillColor=none;strokeColor=#147EBA;dashed=1;verticalAlign=top;fontStyle=0;fontColor=#147EBA;" parent="vpc" vertex="1">
+ 56: <mxGeometry x="50" y="330" width="700" height="200" as="geometry" />
+ 57: </mxCell>
+ 58:
+ 59: <mxCell id="subnet_private" value="Subnet: subnet-088fcb7da00ada6a6
Name: private
AZ: us-east-1a
CIDR: 172.31.128.0/20" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_security_group;grStroke=0;strokeColor=#147EBA;fillColor=#E6F2F8;verticalAlign=top;align=left;spacingLeft=30;fontColor=#147EBA;dashed=0;" parent="vpc" vertex="1">
+ 60: <mxGeometry x="70" y="380" width="200" height="100" as="geometry" />
+ 61: </mxCell>
+ 62:
+ 63: <!-- Route Tables -->
+ 64: <mxCell id="rt_main" value="Main Route Table: rtb-b0b1d9cd
Routes:
- 172.31.0.0/16 → local
- 0.0.0.0/0 → igw-aca290d5" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.route_table;fillColor=#F58536;gradientColor=none;" parent="vpc" vertex="1">
+ 65: <mxGeometry x="600" y="380" width="75" height="69" as="geometry" />
+ 66: </mxCell>
+ 67:
+ 68: <mxCell id="rt_private" value="Private Route Table: rtb-04c48a47ba74ebead
Name: private
Routes:
- 172.31.0.0/16 → local" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.route_table;fillColor=#F58536;gradientColor=none;" parent="vpc" vertex="1">
+ 69: <mxGeometry x="350" y="380" width="75" height="69" as="geometry" />
+ 70: </mxCell>
+ 71:
+ 72: <!-- Security Group -->
+ 73: <mxCell id="sg_default" value="Security Group: sg-77560403
Name: default
Inbound: Allow all traffic from sg-77560403
Outbound: Allow all traffic to 0.0.0.0/0" style="fillColor=#f5f5f5;strokeColor=#666666;dashed=0;verticalAlign=top;fontStyle=0;fontColor=#333333;" parent="vpc" vertex="1">
+ 74: <mxGeometry x="300" y="480" width="300" height="60" as="geometry" />
+ 75: </mxCell>
+ 76:
+ 77: <!-- Connections -->
+ 78: <mxCell id="conn_igw_vpc" value="" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="vpc" source="igw" target="vpc">
+ 79: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 80: <mxPoint x="400" y="30" as="sourcePoint" />
+ 81: <mxPoint x="400" y="40" as="targetPoint" />
+ 82: </mxGeometry>
+ 83: </mxCell>
+ 84:
+ 85: <!-- Connection between private subnet and private route table -->
+ 86: <mxCell id="conn_private_rt" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="vpc" source="subnet_private" target="rt_private">
+ 87: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 88: <mxPoint x="270" y="430" as="sourcePoint" />
+ 89: <mxPoint x="350" y="430" as="targetPoint" />
+ 90: </mxGeometry>
+ 91: </mxCell>
+ 92:
+ 93: </root>
+ 94: </mxGraphModel>
+ 95: </diagram>
+ 96: </mxfile>
Enter y to run this tool, otherwise continue chatting.
> y
Writing to filesystem...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Creating: /home/kbushi/workspace/terraform/aws_vpc_diagram.drawio
🟢 Completed in 0.1s
us-east-1
のリージョンを調べてしまっているので、ap-northeast-1
を調べさせる。
変更したプロンプト
> AWS CLIの terraformのプロファイルを使用してVPCのリソースを調査してdraw.ioの構成図を出力して。調査対象のリ ージョンは東京リージョンです。
結果2
> AWS CLIの terraformのプロファイルを使用してVPCのリソースを調査してdraw.ioの構成図を出力して。調査対象のリ ージョンは東京リージョンです。
⠸ Thinking...
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-vpcs
Profile name: terraform
Region: ap-northeast-1
Label: List VPCs in Tokyo region using terraform profile
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.959s
東京リージョンには2つのVPCがあります。デフォルトVPCと、カスタムVPC(vpc-0e7aa647547f5232e)があります。カス
タムVPCの詳細を調査していきましょう。
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-subnets
Parameters:
- Filters: [{"Name":"vpc-id","Values":["vpc-0e7aa647547f5232e"]}]
Profile name: terraform
Region: ap-northeast-1
Label: List subnets in Tokyo region using terraform profile
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.756s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-internet-gateways
Parameters:
- Filters: [{"Name":"attachment.vpc-id","Values":["vpc-0e7aa647547f5232e"]}]
Profile name: terraform
Region: ap-northeast-1
Label: List internet gateways in Tokyo region using terraform profile
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.888s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-route-tables
Parameters:
- Filters: [{"Name":"vpc-id","Values":["vpc-0e7aa647547f5232e"]}]
Profile name: terraform
Region: ap-northeast-1
Label: List route tables in Tokyo region using terraform profile
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.663s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-nat-gateways
Parameters:
- Filter: [{"Name":"vpc-id","Values":["vpc-0e7aa647547f5232e"]}]
Profile name: terraform
Region: ap-northeast-1
Label: List NAT gateways in Tokyo region using terraform profile
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.660s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-security-groups
Parameters:
- Filters: [{"Name":"vpc-id","Values":["vpc-0e7aa647547f5232e"]}]
Profile name: terraform
Region: ap-northeast-1
Label: List security groups in Tokyo region using terraform profile
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.846s
Write to filesystem
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Path: /home/kbushi/workspace/terraform/aws_vpc_diagram_tokyo.drawio
+ 1: <mxfile host="app.diagrams.net" modified="2025-03-16T10:19:52.000Z" agent="Amazon Q" etag="diagram_etag" version="21.7.5" type="device">
+ 2: <diagram id="AWS-VPC-Architecture" name="AWS VPC Architecture">
+ 3: <mxGraphModel dx="1422" dy="762" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="850" background="#ffffff" math="0" shadow="0">
+ 4: <root>
+ 5: <mxCell id="0" />
+ 6: <mxCell id="1" parent="0" />
+ 7: <!-- AWS Cloud -->
+ 8: <mxCell id="cloud" value="AWS Cloud" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_aws_cloud;strokeColor=#232F3E;fillColor=none;verticalAlign=top;align=left;spacingLeft=30;fontColor=#232F3E;dashed=0;" parent="1" vertex="1">
+ 9: <mxGeometry x="50" y="50" width="1000" height="700" as="geometry" />
+ 10: </mxCell>
+ 11: <!-- Region -->
+ 12: <mxCell id="region" value="Region: ap-northeast-1 (Tokyo)" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_region;strokeColor=#147EBA;fillColor=none;verticalAlign=top;align=left;spacingLeft=30;fontColor=#147EBA;dashed=1;" parent="cloud" vertex="1">
+ 13: <mxGeometry x="50" y="40" width="900" height="630" as="geometry" />
+ 14: </mxCell>
+ 15: <!-- VPC -->
+ 16: <mxCell id="vpc" value="VPC: vpc-0e7aa647547f5232e
CIDR: 10.0.0.0/16" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_vpc;strokeColor=#248814;fillColor=none;verticalAlign=top;align=left;spacingLeft=30;fontColor=#AAB7B8;dashed=0;" parent="region" vertex="1">
+ 17: <mxGeometry x="50" y="40" width="800" height="560" as="geometry" />
+ 18: </mxCell>
+ 19:
+ 20: <!-- Internet Gateway -->
+ 21: <mxCell id="igw" value="Internet Gateway
igw-0a57e51b906e598a4" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.internet_gateway;fillColor=#F58534;gradientColor=none;" parent="vpc" vertex="1">
+ 22: <mxGeometry x="375" y="-20" width="50" height="50" as="geometry" />
+ 23: </mxCell>
+ 24:
+ 25: <!-- Public Subnets -->
+ 26: <mxCell id="public_subnet_group" value="Public Subnets" style="fillColor=none;strokeColor=#147EBA;dashed=1;verticalAlign=top;fontStyle=0;fontColor=#147EBA;" parent="vpc" vertex="1">
+ 27: <mxGeometry x="50" y="60" width="700" height="200" as="geometry" />
+ 28: </mxCell>
+ 29:
+ 30: <mxCell id="subnet_1a" value="Subnet: subnet-02bbbfb6abb7900ee
AZ: ap-northeast-1a
CIDR: 10.0.1.0/24
Public IP: Yes" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_security_group;grStroke=0;strokeColor=#248814;fillColor=#E9F3E6;verticalAlign=top;align=left;spacingLeft=30;fontColor=#248814;dashed=0;" parent="vpc" vertex="1">
+ 31: <mxGeometry x="70" y="100" width="200" height="100" as="geometry" />
+ 32: </mxCell>
+ 33:
+ 34: <mxCell id="subnet_1c" value="Subnet: subnet-03a0c5caa943ba9f6
AZ: ap-northeast-1c
CIDR: 10.0.3.0/24
Public IP: Yes" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_security_group;grStroke=0;strokeColor=#248814;fillColor=#E9F3E6;verticalAlign=top;align=left;spacingLeft=30;fontColor=#248814;dashed=0;" parent="vpc" vertex="1">
+ 35: <mxGeometry x="300" y="100" width="200" height="100" as="geometry" />
+ 36: </mxCell>
+ 37:
+ 38: <!-- NAT Gateway -->
+ 39: <mxCell id="nat" value="NAT Gateway
nat-005101ddcb83e2a69
EIP: 35.76.199.103" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.vpc_nat_gateway;fillColor=#F58534;gradientColor=none;" parent="vpc" vertex="1">
+ 40: <mxGeometry x="145" y="150" width="50" height="50" as="geometry" />
+ 41: </mxCell>
+ 42:
+ 43: <!-- Private Subnet -->
+ 44: <mxCell id="private_subnet_group" value="Private Subnet" style="fillColor=none;strokeColor=#147EBA;dashed=1;verticalAlign=top;fontStyle=0;fontColor=#147EBA;" parent="vpc" vertex="1">
+ 45: <mxGeometry x="50" y="280" width="700" height="200" as="geometry" />
+ 46: </mxCell>
+ 47:
+ 48: <mxCell id="subnet_private" value="Subnet: subnet-0539ee6aeecd613c8
AZ: ap-northeast-1a
CIDR: 10.0.2.0/24
Public IP: No" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_security_group;grStroke=0;strokeColor=#147EBA;fillColor=#E6F2F8;verticalAlign=top;align=left;spacingLeft=30;fontColor=#147EBA;dashed=0;" parent="vpc" vertex="1">
+ 49: <mxGeometry x="70" y="330" width="200" height="100" as="geometry" />
+ 50: </mxCell>
+ 51:
+ 52: <!-- Route Tables -->
+ 53: <mxCell id="rt_main" value="Main Route Table: rtb-0045d2bd228a3ed9e
Routes:
- 10.0.0.0/16 → local" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.route_table;fillColor=#F58536;gradientColor=none;" parent="vpc" vertex="1">
+ 54: <mxGeometry x="600" y="330" width="75" height="69" as="geometry" />
+ 55: </mxCell>
+ 56:
+ 57: <mxCell id="rt_public" value="Public Route Table: rtb-0063c0b10cf3001a4
Routes:
- 10.0.0.0/16 → local
- 0.0.0.0/0 → igw-0a57e51b906e598a4" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.route_table;fillColor=#F58536;gradientColor=none;" parent="vpc" vertex="1">
+ 58: <mxGeometry x="600" y="130" width="75" height="69" as="geometry" />
+ 59: </mxCell>
+ 60:
+ 61: <mxCell id="rt_private" value="Private Route Table: rtb-0a481da74f838caa9
Routes:
- 10.0.0.0/16 → local
- 0.0.0.0/0 → nat-005101ddcb83e2a69" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.route_table;fillColor=#F58536;gradientColor=none;" parent="vpc" vertex="1">
+ 62: <mxGeometry x="350" y="330" width="75" height="69" as="geometry" />
+ 63: </mxCell>
+ 64:
+ 65: <!-- Security Groups -->
+ 66: <mxCell id="sg_group" value="Security Groups" style="fillColor=none;strokeColor=#DD3522;dashed=1;verticalAlign=top;fontStyle=0;fontColor=#DD3522;" parent="vpc" vertex="1">
+ 67: <mxGeometry x="50" y="490" width="700" height="60" as="geometry" />
+ 68: </mxCell>
+ 69:
+ 70: <mxCell id="sg_default" value="default: sg-04aeb3c51d11ceee2" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" parent="vpc" vertex="1">
+ 71: <mxGeometry x="70" y="510" width="160" height="30" as="geometry" />
+ 72: </mxCell>
+ 73:
+ 74: <mxCell id="sg_web" value="web: sg-0966157963470caaf" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" parent="vpc" vertex="1">
+ 75: <mxGeometry x="240" y="510" width="160" height="30" as="geometry" />
+ 76: </mxCell>
+ 77:
+ 78: <mxCell id="sg_ssh" value="ssh: sg-0385b267a021463b2" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" parent="vpc" vertex="1">
+ 79: <mxGeometry x="410" y="510" width="160" height="30" as="geometry" />
+ 80: </mxCell>
+ 81:
+ 82: <mxCell id="sg_alb" value="alb: sg-0d2e03722b06ba681" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" parent="vpc" vertex="1">
+ 83: <mxGeometry x="580" y="510" width="160" height="30" as="geometry" />
+ 84: </mxCell>
+ 85:
+ 86: <!-- Connections -->
+ 87: <mxCell id="conn_igw_vpc" value="" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="vpc" source="igw" target="vpc">
+ 88: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 89: <mxPoint x="400" y="30" as="sourcePoint" />
+ 90: <mxPoint x="400" y="40" as="targetPoint" />
+ 91: </mxGeometry>
+ 92: </mxCell>
+ 93:
+ 94: <!-- Connection between public subnets and public route table -->
+ 95: <mxCell id="conn_public_rt" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="vpc" source="subnet_1a" target="rt_public">
+ 96: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 97: <mxPoint x="270" y="150" as="sourcePoint" />
+ 98: <mxPoint x="600" y="150" as="targetPoint" />
+ 99: </mxGeometry>
+ 100: </mxCell>
+ 101:
+ 102: <mxCell id="conn_public_rt2" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="vpc" source="subnet_1c" target="rt_public">
+ 103: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 104: <mxPoint x="500" y="150" as="sourcePoint" />
+ 105: <mxPoint x="600" y="150" as="targetPoint" />
+ 106: </mxGeometry>
+ 107: </mxCell>
+ 108:
+ 109: <!-- Connection between private subnet and private route table -->
+ 110: <mxCell id="conn_private_rt" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="vpc" source="subnet_private" target="rt_private">
+ 111: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 112: <mxPoint x="270" y="380" as="sourcePoint" />
+ 113: <mxPoint x="350" y="380" as="targetPoint" />
+ 114: </mxGeometry>
+ 115: </mxCell>
+ 116:
+ 117: <!-- Connection between NAT Gateway and private route table -->
+ 118: <mxCell id="conn_nat_rt" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="vpc" source="nat" target="subnet_private">
+ 119: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 120: <mxPoint x="170" y="200" as="sourcePoint" />
+ 121: <mxPoint x="170" y="330" as="targetPoint" />
+ 122: </mxGeometry>
+ 123: </mxCell>
+ 124:
+ 125: </root>
+ 126: </mxGraphModel>
+ 127: </diagram>
+ 128: </mxfile>
Enter y to run this tool, otherwise continue chatting.
> y
Writing to filesystem...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Creating: /home/kbushi/workspace/terraform/aws_vpc_diagram_tokyo.drawio
🟢 Completed in 0.1s
Execute shell command
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I will run the following shell command:
ls -la /home/kbushi/workspace/terraform/aws_vpc_diagram_tokyo.drawio
Executing `ls -la /home/kbushi/workspace/terraform/aws_vpc_diagram_tokyo.drawio`...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-rw-r--r-- 1 kbushi kbushi 11378 Mar 16 19:21 /home/kbushi/workspace/terraform/aws_vpc_diagram_tokyo.drawio
🟢 Completed in 0.5s
東京リージョン(ap-northeast-1)のVPCリソースを調査し、draw.io形式の構成図を作成しました。
調査結果の概要:
1. VPC情報:
• VPC ID: vpc-0e7aa647547f5232e
• CIDR: 10.0.0.0/16
• デフォルトVPCではない
2. サブネット情報:
• パブリックサブネット2つ:
• subnet-02bbbfb6abb7900ee (ap-northeast-1a, 10.0.1.0/24)
• subnet-03a0c5caa943ba9f6 (ap-northeast-1c, 10.0.3.0/24)
• プライベートサブネット1つ:
• subnet-0539ee6aeecd613c8 (ap-northeast-1a, 10.0.2.0/24)
3. インターネットゲートウェイ:
• igw-0a57e51b906e598a4
4. NATゲートウェイ:
• nat-005101ddcb83e2a69 (パブリックサブネットに配置)
• Elastic IP: 35.76.199.103
5. ルートテーブル:
• メインルートテーブル (rtb-0045d2bd228a3ed9e)
• パブリックルートテーブル (rtb-0063c0b10cf3001a4)
• ルート: 10.0.0.0/16 → local、0.0.0.0/0 → インターネットゲートウェイ
• プライベートルートテーブル (rtb-0a481da74f838caa9)
• ルート: 10.0.0.0/16 → local、0.0.0.0/0 → NATゲートウェイ
6. セキュリティグループ:
• default (sg-04aeb3c51d11ceee2)
• web (sg-0966157963470caaf) - HTTP (80) 許可
• ssh (sg-0385b267a021463b2) - 特定IPからのSSH (22) 許可
• alb (sg-0d2e03722b06ba681) - HTTP (80) 許可
• for_private_ssh (sg-0aec22382977bebb4) - プライベートサブネットへのSSH許可
draw.ioファイルを作成しました:/home/kbushi/workspace/terraform/aws_vpc_diagram_tokyo.drawio
このファイルを開くには:
1. https://app.diagrams.net/ にアクセス
2. ファイル > 開く から作成したファイルを選択
3. 必要に応じて編集し、SVG形式でエクスポートできます
または、draw.io Desktop版がインストールされている場合は、そちらで直接開くこともできます。
完成した構成図

※ ELB, EC2が入っていない…。
改善したものを再度実行してみる。
変更したプロンプト2
> AWS CLIの terraformのプロファイルを使用してVPCのリソースを調査してdraw.ioの構成図を出力して。調査対象のリ ージョンは東京リージョンです。
結果3
> AWS CLIの terraformのプロファイルを使用してVPC内のリソース(VPC, ELB, EC2等関連するものすべて)を調査してdra
w.ioの構成図を出力して。調査対象のリージョンは東京リージョンです。
東京リージョンのVPC内のリソース(VPC、ELB、EC2など関連するものすべて)を調査し、draw.ioの構成図を作成します
。
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-vpcs
Profile name: terraform
Region: ap-northeast-1
Label: List VPCs in Tokyo region
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 1.3s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-subnets
Parameters:
- Filters: [{"Name":"vpc-id","Values":["vpc-0e7aa647547f5232e"]}]
Profile name: terraform
Region: ap-northeast-1
Label: List subnets in custom VPC
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.747s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-internet-gateways
Parameters:
- Filters: [{"Name":"attachment.vpc-id","Values":["vpc-0e7aa647547f5232e"]}]
Profile name: terraform
Region: ap-northeast-1
Label: List internet gateways
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.680s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-nat-gateways
Parameters:
- Filter: [{"Name":"vpc-id","Values":["vpc-0e7aa647547f5232e"]}]
Profile name: terraform
Region: ap-northeast-1
Label: List NAT gateways
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.744s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-route-tables
Parameters:
- Filters: [{"Name":"vpc-id","Values":["vpc-0e7aa647547f5232e"]}]
Profile name: terraform
Region: ap-northeast-1
Label: List route tables
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.742s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-security-groups
Parameters:
- Filters: [{"Name":"vpc-id","Values":["vpc-0e7aa647547f5232e"]}]
Profile name: terraform
Region: ap-northeast-1
Label: List security groups
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.794s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: ec2
Operation name: describe-instances
Parameters:
- Filters: [{"Name":"vpc-id","Values":["vpc-0e7aa647547f5232e"]}]
Profile name: terraform
Region: ap-northeast-1
Label: List EC2 instances
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.765s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: elbv2
Operation name: describe-load-balancers
Profile name: terraform
Region: ap-northeast-1
Label: List load balancers
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.696s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: elbv2
Operation name: describe-target-groups
Parameters:
- LoadBalancerArn: "arn:aws:elasticloadbalancing:ap-northeast-1:037292740688:loadbalancer/app/alb/0f30c8fffd809cc7"
Profile name: terraform
Region: ap-northeast-1
Label: List target groups
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.766s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: elbv2
Operation name: describe-target-health
Parameters:
- TargetGroupArn: "arn:aws:elasticloadbalancing:ap-northeast-1:037292740688:targetgroup/target/7303e4fa55b368ec"
Profile name: terraform
Region: ap-northeast-1
Label: List target health
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.769s
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: elbv2
Operation name: describe-listeners
Parameters:
- LoadBalancerArn: "arn:aws:elasticloadbalancing:ap-northeast-1:037292740688:loadbalancer/app/alb/0f30c8fffd809cc7"
Profile name: terraform
Region: ap-northeast-1
Label: List listeners
Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
🟢 Completed in 0.565s
Write to filesystem
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Path: /home/kbushi/workspace/terraform/aws_vpc_diagram_tokyo_full.drawio
+ 1: <mxfile host="app.diagrams.net" modified="2025-03-16T10:36:04.000Z" agent="Amazon Q" etag="diagram_etag" version="21.7.5" type="device">
+ 2: <diagram id="AWS-VPC-Architecture" name="AWS VPC Architecture">
+ 3: <mxGraphModel dx="1422" dy="762" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="850" background="#ffffff" math="0" shadow="0">
+ 4: <root>
+ 5: <mxCell id="0" />
+ 6: <mxCell id="1" parent="0" />
+ 7: <!-- AWS Cloud -->
+ 8: <mxCell id="cloud" value="AWS Cloud" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_aws_cloud;strokeColor=#232F3E;fillColor=none;verticalAlign=top;align=left;spacingLeft=30;fontColor=#232F3E;dashed=0;" parent="1" vertex="1">
+ 9: <mxGeometry x="50" y="50" width="1000" height="750" as="geometry" />
+ 10: </mxCell>
+ 11: <!-- Region -->
+ 12: <mxCell id="region" value="Region: ap-northeast-1 (Tokyo)" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_region;strokeColor=#147EBA;fillColor=none;verticalAlign=top;align=left;spacingLeft=30;fontColor=#147EBA;dashed=1;" parent="cloud" vertex="1">
+ 13: <mxGeometry x="50" y="40" width="900" height="680" as="geometry" />
+ 14: </mxCell>
+ 15: <!-- VPC -->
+ 16: <mxCell id="vpc" value="VPC: vpc-0e7aa647547f5232e
CIDR: 10.0.0.0/16" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_vpc;strokeColor=#248814;fillColor=none;verticalAlign=top;align=left;spacingLeft=30;fontColor=#AAB7B8;dashed=0;" parent="region" vertex="1">
+ 17: <mxGeometry x="50" y="40" width="800" height="620" as="geometry" />
+ 18: </mxCell>
+ 19:
+ 20: <!-- Internet Gateway -->
+ 21: <mxCell id="igw" value="Internet Gateway
igw-0a57e51b906e598a4" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.internet_gateway;fillColor=#F58534;gradientColor=none;" parent="vpc" vertex="1">
+ 22: <mxGeometry x="375" y="-20" width="50" height="50" as="geometry" />
+ 23: </mxCell>
+ 24:
+ 25: <!-- Application Load Balancer -->
+ 26: <mxCell id="alb" value="Application Load Balancer
alb
alb-256049122.ap-northeast-1.elb.amazonaws.com" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.application_load_balancer;fillColor=#F58534;gradientColor=none;" parent="vpc" vertex="1">
+ 27: <mxGeometry x="375" y="60" width="50" height="50" as="geometry" />
+ 28: </mxCell>
+ 29:
+ 30: <!-- Public Subnets -->
+ 31: <mxCell id="public_subnet_group" value="Public Subnets" style="fillColor=none;strokeColor=#147EBA;dashed=1;verticalAlign=top;fontStyle=0;fontColor=#147EBA;" parent="vpc" vertex="1">
+ 32: <mxGeometry x="50" y="130" width="700" height="220" as="geometry" />
+ 33: </mxCell>
+ 34:
+ 35: <mxCell id="subnet_1a" value="Subnet: subnet-02bbbfb6abb7900ee
AZ: ap-northeast-1a
CIDR: 10.0.1.0/24
Public IP: Yes" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_security_group;grStroke=0;strokeColor=#248814;fillColor=#E9F3E6;verticalAlign=top;align=left;spacingLeft=30;fontColor=#248814;dashed=0;" parent="vpc" vertex="1">
+ 36: <mxGeometry x="70" y="170" width="300" height="160" as="geometry" />
+ 37: </mxCell>
+ 38:
+ 39: <!-- EC2 Instance in Public Subnet -->
+ 40: <mxCell id="ec2_public" value="EC2 Instance
i-0c9e5c5c0b5c5c5c5
Name: SamplePublicEC2Instance
t4g.micro
13.231.153.146" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.instance;fillColor=#F58534;gradientColor=none;" parent="subnet_1a" vertex="1">
+ 41: <mxGeometry x="125" y="60" width="50" height="50" as="geometry" />
+ 42: </mxCell>
+ 43:
+ 44: <mxCell id="subnet_1c" value="Subnet: subnet-03a0c5caa943ba9f6
AZ: ap-northeast-1c
CIDR: 10.0.3.0/24
Public IP: Yes" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_security_group;grStroke=0;strokeColor=#248814;fillColor=#E9F3E6;verticalAlign=top;align=left;spacingLeft=30;fontColor=#248814;dashed=0;" parent="vpc" vertex="1">
+ 45: <mxGeometry x="430" y="170" width="300" height="160" as="geometry" />
+ 46: </mxCell>
+ 47:
+ 48: <!-- NAT Gateway -->
+ 49: <mxCell id="nat" value="NAT Gateway
nat-005101ddcb83e2a69
EIP: 35.76.199.103" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.vpc_nat_gateway;fillColor=#F58534;gradientColor=none;" parent="subnet_1a" vertex="1">
+ 50: <mxGeometry x="30" y="60" width="50" height="50" as="geometry" />
+ 51: </mxCell>
+ 52:
+ 53: <!-- Private Subnet -->
+ 54: <mxCell id="private_subnet_group" value="Private Subnet" style="fillColor=none;strokeColor=#147EBA;dashed=1;verticalAlign=top;fontStyle=0;fontColor=#147EBA;" parent="vpc" vertex="1">
+ 55: <mxGeometry x="50" y="370" width="700" height="160" as="geometry" />
+ 56: </mxCell>
+ 57:
+ 58: <mxCell id="subnet_private" value="Subnet: subnet-0539ee6aeecd613c8
AZ: ap-northeast-1a
CIDR: 10.0.2.0/24
Public IP: No" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_security_group;grStroke=0;strokeColor=#147EBA;fillColor=#E6F2F8;verticalAlign=top;align=left;spacingLeft=30;fontColor=#147EBA;dashed=0;" parent="vpc" vertex="1">
+ 59: <mxGeometry x="70" y="410" width="300" height="100" as="geometry" />
+ 60: </mxCell>
+ 61:
+ 62: <!-- EC2 Instance in Private Subnet -->
+ 63: <mxCell id="ec2_private" value="EC2 Instance
i-0db8835b3d25fae2f
Name: SamplePrivateEC2Instance
t4g.micro" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.instance;fillColor=#F58534;gradientColor=none;" parent="subnet_private" vertex="1">
+ 64: <mxGeometry x="125" y="40" width="50" height="50" as="geometry" />
+ 65: </mxCell>
+ 66:
+ 67: <!-- Route Tables -->
+ 68: <mxCell id="rt_main" value="Main Route Table: rtb-0045d2bd228a3ed9e
Routes:
- 10.0.0.0/16 → local" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.route_table;fillColor=#F58536;gradientColor=none;" parent="vpc" vertex="1">
+ 69: <mxGeometry x="600" y="410" width="75" height="69" as="geometry" />
+ 70: </mxCell>
+ 71:
+ 72: <mxCell id="rt_public" value="Public Route Table: rtb-0063c0b10cf3001a4
Routes:
- 10.0.0.0/16 → local
- 0.0.0.0/0 → igw-0a57e51b906e598a4" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.route_table;fillColor=#F58536;gradientColor=none;" parent="vpc" vertex="1">
+ 73: <mxGeometry x="600" y="200" width="75" height="69" as="geometry" />
+ 74: </mxCell>
+ 75:
+ 76: <mxCell id="rt_private" value="Private Route Table: rtb-0a481da74f838caa9
Routes:
- 10.0.0.0/16 → local
- 0.0.0.0/0 → nat-005101ddcb83e2a69" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.route_table;fillColor=#F58536;gradientColor=none;" parent="vpc" vertex="1">
+ 77: <mxGeometry x="430" y="410" width="75" height="69" as="geometry" />
+ 78: </mxCell>
+ 79:
+ 80: <!-- Security Groups -->
+ 81: <mxCell id="sg_group" value="Security Groups" style="fillColor=none;strokeColor=#DD3522;dashed=1;verticalAlign=top;fontStyle=0;fontColor=#DD3522;" parent="vpc" vertex="1">
+ 82: <mxGeometry x="50" y="550" width="700" height="60" as="geometry" />
+ 83: </mxCell>
+ 84:
+ 85: <mxCell id="sg_default" value="default: sg-04aeb3c51d11ceee2" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" parent="vpc" vertex="1">
+ 86: <mxGeometry x="70" y="570" width="160" height="30" as="geometry" />
+ 87: </mxCell>
+ 88:
+ 89: <mxCell id="sg_web" value="web: sg-0966157963470caaf" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" parent="vpc" vertex="1">
+ 90: <mxGeometry x="240" y="570" width="160" height="30" as="geometry" />
+ 91: </mxCell>
+ 92:
+ 93: <mxCell id="sg_ssh" value="ssh: sg-0385b267a021463b2" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" parent="vpc" vertex="1">
+ 94: <mxGeometry x="410" y="570" width="160" height="30" as="geometry" />
+ 95: </mxCell>
+ 96:
+ 97: <mxCell id="sg_alb" value="alb: sg-0d2e03722b06ba681" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" parent="vpc" vertex="1">
+ 98: <mxGeometry x="580" y="570" width="160" height="30" as="geometry" />
+ 99: </mxCell>
+ 100:
+ 101: <!-- Target Group -->
+ 102: <mxCell id="tg_group" value="Target Group: target
Protocol: HTTP:80
Health Check: HTTP:80/index.html" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;align=center;" parent="vpc" vertex="1">
+ 103: <mxGeometry x="300" y="110" width="200" height="50" as="geometry" />
+ 104: </mxCell>
+ 105:
+ 106: <!-- Connections -->
+ 107: <mxCell id="conn_igw_vpc" value="" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="vpc" source="igw" target="alb">
+ 108: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 109: <mxPoint x="400" y="30" as="sourcePoint" />
+ 110: <mxPoint x="400" y="40" as="targetPoint" />
+ 111: </mxGeometry>
+ 112: </mxCell>
+ 113:
+ 114: <!-- Connection between ALB and Target Group -->
+ 115: <mxCell id="conn_alb_tg" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="vpc" source="alb" target="tg_group">
+ 116: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 117: <mxPoint x="400" y="90" as="sourcePoint" />
+ 118: <mxPoint x="400" y="110" as="targetPoint" />
+ 119: </mxGeometry>
+ 120: </mxCell>
+ 121:
+ 122: <!-- Connection between Target Group and EC2 Instance -->
+ 123: <mxCell id="conn_tg_ec2" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="vpc" source="tg_group" target="ec2_private">
+ 124: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 125: <mxPoint x="400" y="160" as="sourcePoint" />
+ 126: <mxPoint x="220" y="410" as="targetPoint" />
+ 127: <Array as="points">
+ 128: <mxPoint x="400" y="350"/>
+ 129: <mxPoint x="220" y="350"/>
+ 130: </Array>
+ 131: </mxGeometry>
+ 132: </mxCell>
+ 133:
+ 134: <!-- Connection between public subnets and public route table -->
+ 135: <mxCell id="conn_public_rt" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="vpc" source="subnet_1a" target="rt_public">
+ 136: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 137: <mxPoint x="370" y="250" as="sourcePoint" />
+ 138: <mxPoint x="600" y="250" as="targetPoint" />
+ 139: </mxGeometry>
+ 140: </mxCell>
+ 141:
+ 142: <mxCell id="conn_public_rt2" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="vpc" source="subnet_1c" target="rt_public">
+ 143: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 144: <mxPoint x="580" y="250" as="sourcePoint" />
+ 145: <mxPoint x="600" y="250" as="targetPoint" />
+ 146: </mxGeometry>
+ 147: </mxCell>
+ 148:
+ 149: <!-- Connection between private subnet and private route table -->
+ 150: <mxCell id="conn_private_rt" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="vpc" source="subnet_private" target="rt_private">
+ 151: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 152: <mxPoint x="370" y="460" as="sourcePoint" />
+ 153: <mxPoint x="430" y="460" as="targetPoint" />
+ 154: </mxGeometry>
+ 155: </mxCell>
+ 156:
+ 157: <!-- Connection between NAT Gateway and private route table -->
+ 158: <mxCell id="conn_nat_rt" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="vpc" source="nat" target="rt_private">
+ 159: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 160: <mxPoint x="125" y="230" as="sourcePoint" />
+ 161: <mxPoint x="430" y="440" as="targetPoint" />
+ 162: <Array as="points">
+ 163: <mxPoint x="125" y="320"/>
+ 164: <mxPoint x="468" y="320"/>
+ 165: </Array>
+ 166: </mxGeometry>
+ 167: </mxCell>
+ 168:
+ 169: <!-- Connection between EC2 instances -->
+ 170: <mxCell id="conn_ec2_ec2" value="" style="endArrow=classic;html=1;rounded=0;dashed=1;" edge="1" parent="vpc" source="ec2_public" target="ec2_private">
+ 171: <mxGeometry width="50" height="50" relative="1" as="geometry">
+ 172: <mxPoint x="220" y="280" as="sourcePoint" />
+ 173: <mxPoint x="220" y="410" as="targetPoint" />
+ 174: </mxGeometry>
+ 175: </mxCell>
+ 176:
+ 177: </root>
+ 178: </mxGraphModel>
+ 179: </diagram>
+ 180: </mxfile>
Enter y to run this tool, otherwise continue chatting.
> y
Writing to filesystem...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Creating: /home/kbushi/workspace/terraform/aws_vpc_diagram_tokyo_full.drawio
🟢 Completed in 0.1s
Execute shell command
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I will run the following shell command:
ls -la /home/kbushi/workspace/terraform/aws_vpc_diagram_tokyo_full.drawio
Executing `ls -la /home/kbushi/workspace/terraform/aws_vpc_diagram_tokyo_full.drawio`...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-rw-r--r-- 1 kbushi kbushi 14801 Mar 16 19:38 /home/kbushi/workspace/terraform/aws_vpc_diagram_tokyo_full.drawio
🟢 Completed in 0.2s
東京リージョン(ap-northeast-1)のVPC内のすべてのリソースを調査し、詳細な構成図をdraw.io形式で作成しました。
## 調査結果の概要
### VPC情報
• VPC ID: vpc-0e7aa647547f5232e
• CIDR: 10.0.0.0/16
• デフォルトVPCではない
### ネットワーク構成
1. サブネット:
• パブリックサブネット2つ:
• subnet-02bbbfb6abb7900ee (ap-northeast-1a, 10.0.1.0/24)
• subnet-03a0c5caa943ba9f6 (ap-northeast-1c, 10.0.3.0/24)
• プライベートサブネット1つ:
• subnet-0539ee6aeecd613c8 (ap-northeast-1a, 10.0.2.0/24)
2. インターネットゲートウェイ:
• igw-0a57e51b906e598a4
3. NATゲートウェイ:
• nat-005101ddcb83e2a69 (パブリックサブネットに配置)
• Elastic IP: 35.76.199.103
4. ルートテーブル:
• メインルートテーブル (rtb-0045d2bd228a3ed9e)
• ルート: 10.0.0.0/16 → local
• パブリックルートテーブル (rtb-0063c0b10cf3001a4)
• ルート: 10.0.0.0/16 → local、0.0.0.0/0 → インターネットゲートウェイ
• プライベートルートテーブル (rtb-0a481da74f838caa9)
• ルート: 10.0.0.0/16 → local、0.0.0.0/0 → NATゲートウェイ
### コンピューティングリソース
1. EC2インスタンス:
• パブリックサブネット内のインスタンス:
• IP: 13.231.153.146
• タイプ: t4g.micro
• セキュリティグループ: ssh (sg-0385b267a021463b2), web (sg-0966157963470caaf)
• プライベートサブネット内のインスタンス:
• インスタンスID: i-0db8835b3d25fae2f
• 名前: SamplePrivateEC2Instance
• タイプ: t4g.micro
• セキュリティグループ: for_private_ssh (sg-0aec22382977bebb4), alb (sg-0d2e03722b06ba681)
### ロードバランシング
1. Application Load Balancer:
• 名前: alb
• DNS名: alb-256049122.ap-northeast-1.elb.amazonaws.com
• スキーム: インターネット向け
• セキュリティグループ: web (sg-0966157963470caaf)
• サブネット: パブリックサブネット2つ
2. ターゲットグループ:
• 名前: target
• プロトコル: HTTP:80
• ヘルスチェック: HTTP:80/index.html
• ターゲット: プライベートサブネット内のEC2インスタンス (i-0db8835b3d25fae2f)
• ヘルスステータス: unhealthy (404エラー)
3. リスナー:
• ポート: 80
• プロトコル: HTTP
• アクション: ターゲットグループ「target」に転送
### セキュリティグループ
• default (sg-04aeb3c51d11ceee2)
• web (sg-0966157963470caaf) - HTTP (80) 許可
• ssh (sg-0385b267a021463b2) - 特定IPからのSSH (22) 許可
• alb (sg-0d2e03722b06ba681) - HTTP (80) 許可
• for_private_ssh (sg-0aec22382977bebb4) - プライベートサブネットへのSSH許可
## 作成したdraw.ioファイル
/home/kbushi/workspace/terraform/aws_vpc_diagram_tokyo_full.drawio
このファイルを開くには:
1. https://app.diagrams.net/ にアクセス
2. ファイル > 開く から作成したファイルを選択
3. 必要に応じて編集し、SVG形式でエクスポートできます
構成図には、VPC、サブネット、EC2インスタンス、ALB、ターゲットグループ、インターネットゲートウェイ、NATゲート
ウェイ、ルートテーブル、セキュリティグループなど、すべての主要なリソースとそれらの関係が含まれています。
完成した構成図2

参考
コマンドライン用の Amazon Q をインストールする
https://docs.aws.amazon.com/ja_jp/amazonq/latest/qdeveloper-ug/command-line-installing.htmlAmazon Q Developer
https://aws.amazon.com/jp/q/developer/
おわりに
今回はAmazon Q Developer
を使ってみた。
無料で使える分で試してみたが十分な性能だろう。
構成図の作成については、保守移管などの初期解析で全体像を把握する際に使えそうだ。
気になる点としては、構成図で使用している図形が古いところだが、そこはプロンプトで改善できそう。
できた構成図が重なっていたりするので、細かい部分は手で直す形になりそうか。