ChatGPTでAWSの構成図を作成するよう頼んでみた。
依頼文はまずこちら。
日本語にも対応すると聞くが、この手のものは拙くとも英語で聞いておくほうがよいと思うので、英語で書いた。日本語で書いてうまくいかなかったら、英語でないのがダメなのか、内容がダメなのか、どっちなのかわからなくなるので切り分けが面倒くさい。
Create an AWS diagram of `VPC network` using `Plantuml` with the following content.
- region is ap-northeast 1
- 3 az
- use s3 vpc endpoint
- using igw
そして生成されたのがこちら。
@startuml AWS Diagram - VPC Network
!define AWSPUML https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/v14.0/dist
!define Region(ap-northeast-1, Asia Pacific (Tokyo))
!define AZ1(AZ1, Availability Zone 1)
!define AZ2(AZ2, Availability Zone 2)
!define AZ3(AZ3, Availability Zone 3)
!define IGW(IGW, Internet Gateway)
!define SubnetA(SubnetA, Subnet A)
!define SubnetB(SubnetB, Subnet B)
!define SubnetC(SubnetC, Subnet C)
!define EC2(EC2, EC2 Instance)
!define S3Endpoint(S3Endpoint, S3 VPC Endpoint)
!define Internet(Internet, Internet)
!define dashedline(linetype,direction)
skinparam linetype<<linetype>> dashed
skinparam linetype<<linetype>><<direction>> false
!define linetype(linetype)
skinparam linetype<<linetype>> solid
!define direction(direction)
skinparam linetype<<linetype>><<direction>> true
!define showLink(link)
link <<link>>
!define endpointVisibility(visible)
hide circle
hide stereotype
!define Network(network)
network <<Network>>
!define EC2Instance(ec2)
ec2 <<EC2Instance>>
!define AZGroup(group)
group <<AZGroup>>
!define Subnet(subnet)
subnet <<Subnet>>
!define SecurityGroup(securityGroup)
securityGroup <<SecurityGroup>>
!define Gateway(gateway)
gateway <<Gateway>>
!define Database(database)
database <<Database>>
!define Resource(resource)
resource <<Resource>>
!define User(user)
user <<User>>
!define loadIcon(alias,url)
!define <<alias>>(<<alias>>)
!define ![[<<alias>>]](<<alias>>)
!define ![[<<alias>>]](alias)
skinparam componentStyle strictuml
sprite ${{alias}} $url
!loadIcon(Region, AWSPUML/AWSCommon/Region)
!loadIcon(AZ1, AWSPUML/AWSCommon/AZ)
!loadIcon(AZ2, AWSPUML/AWSCommon/AZ)
!loadIcon(AZ3, AWSPUML/AWSCommon/AZ)
!loadIcon(IGW, AWSPUML/AWSNetworkingSecurity/InternetGateway)
!loadIcon(SubnetA, AWSPUML/AWSNetworkingSecurity/Subnet)
!loadIcon(SubnetB, AWSPUML/AWSNetworkingSecurity/Subnet)
!loadIcon(SubnetC, AWSPUML/AWSNetworkingSecurity/Subnet)
!loadIcon(EC2, AWSPUML/Compute/AmazonEC2Instance)
!loadIcon(S3Endpoint, AWSPUML/General/S3)
!define InternetEndpoint(InternetEndpoint, Internet Endpoint)
!define dashedline(dashed)
!define linetype(solid)
!define direction(undeclared)
!define endpointVisibility(visible)
!define showLink(link)
!define Network(Network)
!define EC2Instance(EC2Instance)
!define AZGroup(AZGroup)
!define Subnet(Subnet)
!define SecurityGroup(SecurityGroup)
!define Gateway(Gateway)
!define Database(Database)
!define Resource(Resource)
!define User(User)
Network(Network)
Region(ap-northeast-1) as APNE1 <<Region(ap-northeast-1)>>
AZGroup(AZ1) as Zone1 <<AZGroup(AZ1)>>
AZGroup(AZ2) as Zone2 <<AZGroup(AZ2)>>
AZGroup(AZ3) as Zone3 <<AZGroup(AZ3)>>
Internet(Internet) as Internet <<Internet>>
Gateway(IGW) as IGW <<Gateway(IGW)>>
Subnet(SubnetA) as ASubnet <<Subnet(SubnetA)>>
Subnet(SubnetB) as BSubnet <<Subnet(SubnetB)>>
Subnet(SubnetC) as CSubnet <<Subnet(SubnetC)>>
EC2Instance(EC2) as InstanceA <<EC2Instance(EC2)>>
EC2Instance(EC2) as InstanceB <<EC2Instance(EC2)>>
EC2Instance(EC2) as InstanceC <<EC2Instance(EC2)>>
Resource(S3Endpoint) as EndpointA <<Resource(S3Endpoint)>>
Resource(S3Endpoint) as EndpointB <<Resource(S3Endpoint)>>
Resource(S3Endpoint) as EndpointC <<Resource(S3Endpoint)>>
APNE1 -- Zone1
APNE1 -- Zone2
APNE1 -- Zone3
Zone1 -- IGW : <<IGW>>
Zone2 -- IGW : <<IGW>>
Zone3 -- IGW : <<IGW>>
Zone1 -- ASubnet : <<Subnet>>
Zone2 -- BSubnet : <<Subnet>>
Zone3 -- CSubnet : <<Subnet>>
ASubnet -- InstanceA : <<EC2Instance>>
BSubnet -- InstanceB : <<EC2Instance>>
CSubnet -- InstanceC : <<EC2Instance>>
ASubnet -- EndpointA : <<Resource>>
BSubnet -- EndpointB : <<Resource>>
CSubnet -- EndpointC : <<Resource>>
@enduml
自分が本当に必要だったもの
@startuml AWS Diagram
top to bottom direction
title AWS Diagram - VPC Network
!define AWSPuml https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/v15.0/dist
' https://github.com/awslabs/aws-icons-for-plantuml/blob/main/AWSSymbols.md
!include AWSPuml/AWSCommon.puml
!include AWSPuml/Groups/AWSCloud.puml
!include AWSPuml/Groups/VPC.puml
!include AWSPuml/Groups/PublicSubnet.puml
!include AWSPuml/Groups/PrivateSubnet.puml
!include AWSPuml/Groups/AvailabilityZone.puml
!include AWSPuml/GroupIcons/Region.puml
!include AWSPuml/GroupIcons/VPCSubnetPrivate.puml
!include AWSPuml/NetworkingContentDelivery/VPCNATGateway.puml
!include AWSPuml/NetworkingContentDelivery/VPCInternetGateway.puml
!include AWSPuml/NetworkingContentDelivery/VPCEndpoints.puml
!include AWSPuml/AWSSimplified.puml
AWSCloudGroup(cloud) {
Region("AWSRegion", "ap-northeast-1", "region") {
VPCGroup(vpc, "VPC") {
VPCInternetGateway(internet_gateway, "Internet gateway", "")
VPCEndpoints(s3_endpoint, "S3 VPC Endpoint", "")
AvailabilityZoneGroup("AZ1", "ap-northeast-1a") {
PublicSubnetGroup(az_1_public, "Public subnet") {
VPCNATGateway(az_1_nat_gateway, "NAT gateway", "")
}
PrivateSubnetGroup(az_1_private, "Private subnet") {
}
}
AvailabilityZoneGroup("AZ2", "ap-northeast-1c") {
PublicSubnetGroup(az_2_public, "Public subnet") {
}
PrivateSubnetGroup(az_2_private, "Private subnet") {
}
}
AvailabilityZoneGroup("AZ3", "ap-northeast-1d") {
PublicSubnetGroup(az_3_public, "Public subnet") {
}
PrivateSubnetGroup(az_3_private, "Private subnet") {
}
}
}
}
}
@enduml
残念ながらたたき台にもならなかった。PlantUMLでAWS構成図を書くのはマイナーすぎたのかもしれない。
しかし、うまくいくときはかなり素晴らしいたたき台を作ってくれるのがChatGPTだ。懲りずにどんどん試していこうと思う。