Skip to content

Commit

Permalink
Merge pull request #22 from ugwis/main
Browse files Browse the repository at this point in the history
Add diagram examples
  • Loading branch information
ugwis authored Mar 25, 2024
2 parents 1382a2c + 05cefb9 commit 1cb1b88
Show file tree
Hide file tree
Showing 9 changed files with 442 additions and 10 deletions.
14 changes: 14 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Private instance communicating with the internet through a NAT gateway

![vpc-natgw.png](vpc-natgw.png)
(generated from [vpc-natgw.yaml](vpc-natgw.yaml)

# Load balancing web servers using ALB

![alb-ec2.png](alb-ec2.png)
(generated from [alb-ec2.yaml](alb-ec2.yaml)

# Network firewall that inspects communication between VPCs

![tgw-nwfw.png](tgw-nwfw.png)
(generated from [tgw-nwfw.yaml](tgw-nwfw.yaml)
Binary file added examples/alb-ec2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions examples/alb-ec2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
Diagram:
DefinitionFiles:
- Type: URL
Url: "https://raw.githubusercontent.com/awslabs/diagram-as-code/main/definitions/definition-for-aws-icons-light.yaml"
#- Type: LocalFile
# LocalFile: ./definitions/definition-for-aws-icons-light.yaml

Resources:
Canvas:
Type: AWS::Diagram::Canvas
Direction: vertical
Children:
- AWSCloud
- User
AWSCloud:
Type: AWS::Diagram::Cloud
Direction: vertical
Preset: AWSCloudNoLogo
Align: center
Children:
- VPC
- IGW
# VPC
VPC:
Type: AWS::EC2::VPC
Direction: vertical
Children:
- VPCPublicStack
- ALB
VPCPublicStack:
Type: AWS::Diagram::HorizontalStack
Children:
- VPCPublicSubnet1
- VPCPublicSubnet2
VPCPublicSubnet1:
Type: AWS::EC2::Subnet
Preset: PublicSubnet
Children:
- VPCPublicSubnet1Instance
VPCPublicSubnet1Instance:
Type: AWS::EC2::Instance
VPCPublicSubnet2:
Type: AWS::EC2::Subnet
Preset: PublicSubnet
Children:
- VPCPublicSubnet2Instance
VPCPublicSubnet2Instance:
Type: AWS::EC2::Instance
ALB:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Preset: Application Load Balancer
IGW:
Type: AWS::EC2::InternetGateway
User:
Type: AWS::Diagram::Resource
Preset: User

Links:
- Source: ALB
SourcePosition: NNW
Target: VPCPublicSubnet1Instance
TargetPosition: SSE
- Source: ALB
SourcePosition: NNE
Target: VPCPublicSubnet2Instance
TargetPosition: SSW
- Source: IGW
SourcePosition: N
Target: ALB
TargetPosition: S
- Source: User
SourcePosition: N
Target: IGW
TargetPosition: S
Binary file added examples/privatelink.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
129 changes: 129 additions & 0 deletions examples/privatelink.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
Diagram:
DefinitionFiles:
- Type: URL
Url: "https://raw.githubusercontent.com/awslabs/diagram-as-code/main/definitions/definition-for-aws-icons-light.yaml"
#- Type: LocalFile
# LocalFile: ./definitions/definition-for-aws-icons-light.yaml
Resources:
Canvas:
Type: AWS::Diagram::Canvas
Direction: vertical
Children:
- AWSCloud
- User
AWSCloud:
Type: AWS::Diagram::Cloud
Direction: vertical
Align: center
Children:
- HorizontalStack1
- HorizontalStack2
HorizontalStack1:
Type: AWS::Diagram::HorizontalStack
Children:
- VPC1
- PrivateLinkGroup
- VPC2
# VPC1
VPC1:
Type: AWS::EC2::VPC
Title: "VPC1 (10.0.0.0/16)"
Children:
- VPC1PublicStack
- NLB1

VPC1PublicStack:
Type: AWS::Diagram::VerticalStack
Children:
- VPC1PublicSubnet1
- VPC1PublicSubnet2
VPC1PublicSubnet1:
Type: AWS::EC2::Subnet
Preset: PublicSubnet
Children:
- VPC1PublicSubnet1Instance
VPC1PublicSubnet1Instance:
Type: AWS::EC2::Instance
VPC1PublicSubnet2:
Type: AWS::EC2::Subnet
Preset: PublicSubnet
Children:
- VPC1PublicSubnet2Instance
VPC1PublicSubnet2Instance:
Type: AWS::EC2::Instance
NLB1:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Preset: Network Load Balancer

PrivateLinkGroup:
Type: AWS::Diagram::Group
Preset: BlankGroup
Children:
- PrivateLink

PrivateLink:
Type: AWS::Diagram::Resource
Preset: AWS PrivateLink

# VPC2
VPC2:
Type: AWS::EC2::VPC
Title: "VPC2 (10.1.0.0/16)"
Children:
- VPC2Endpoint
- VPC2PublicStack

VPC2Endpoint:
Type: AWS::EC2::VPCEndpoint

VPC2PublicStack:
Type: AWS::Diagram::VerticalStack
Children:
- VPC2PublicSubnet1
- VPC2PublicSubnet2
VPC2PublicSubnet1:
Type: AWS::EC2::Subnet
Preset: PublicSubnet
Children:
- VPC2PublicSubnet1Instance
VPC2PublicSubnet1Instance:
Type: AWS::EC2::Instance
VPC2PublicSubnet2:
Type: AWS::EC2::Subnet
Preset: PublicSubnet
HorizontalStack2:
Type: AWS::Diagram::HorizontalStack
Align: bottom
Children:
- IGW1
- IGW2
IGW1:
Type: AWS::EC2::InternetGateway
IGW2:
Type: AWS::EC2::InternetGateway

User:
Type: AWS::Diagram::Resource
Preset: User

Links:
- Source: VPC2PublicSubnet1Instance
SourcePosition: W
Target: VPC2Endpoint
TargetPosition: E
- Source: VPC2Endpoint
SourcePosition: W
Target: PrivateLink
TargetPosition: E
- Source: PrivateLink
SourcePosition: W
Target: NLB1
TargetPosition: E
- Source: NLB1
SourcePosition: W
Target: VPC1PublicSubnet1Instance
TargetPosition: E
- Source: NLB1
SourcePosition: W
Target: VPC1PublicSubnet2Instance
TargetPosition: E
Binary file added examples/tgw-nwfw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1cb1b88

Please sign in to comment.