-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGwlbWithTargetGroupAndListenerSample.yaml
148 lines (138 loc) · 4.51 KB
/
GwlbWithTargetGroupAndListenerSample.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Following example shows how to create AWS Gateway Load Balancer,
# target group and listener using AWS CloudFormation. It also registers
# targets with target group.
AWSTemplateFormatVersion: "2010-09-09"
Description: >-
AWS CloudFormation Sample Template for Gateway Load Balancer (GWLB).
This template creates:
- 1 GWLB
- 1 Target group for GWLB
- 1 Listner for GWLB
- Register intance to target group assigned to GWLB
**WARNING** This template creates a Gateway Load Balancer You will be billed
for the AWS resources used if you create a stack from this template.
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: 'Gateway Load Balancer Configuration'
Parameters:
- GwlbName
- GwlbSubnets
- Label:
default: 'Target Group Configuration'
Parameters:
- TargetGroupName
- HealthPort
- HealthProtocol
- VpcId
- Appliance1InstanceId
- Appliance2InstanceId
ParameterLabels:
GwlbName:
default: Gateway Load Balancer Name
GwlbSubnets:
default: List of Subnet Ids for GWLB
TargetGroupName:
default: Target Group Name
HealthPort:
default: Health Check Port
HealthProtocol:
default: Health Check Protocol
VpcId:
default: VPC Id for target group
Appliance1InstanceId:
default: Appliance 1 instance id
Appliance2InstanceId:
default: Appliance 2 instance id
Parameters:
GwlbName:
Description: >-
Gateway Load Balancer name. This name must be unique within your AWS
account and can have a maximum of 32 alphanumeric characters and
hyphens. A name cannot begin or end with a hyphen.
Type: String
Default: gwlb1
ConstraintDescription: Must be a valid GWLB Name
GwlbSubnets:
Description: >-
List of subnets to associate with your GWLB.
(e.g., ['subnet-123a351e', subnet-456a351e])
Type: List<AWS::EC2::Subnet::Id>
ConstraintDescription: Must be a valid list of subnet ids
TargetGroupName:
Description: Target Group Name
Type: String
Default: tg1
ConstraintDescription: Must be a valid target group name
HealthProtocol:
Description: >-
The protocol the appliane gateway uses when performing health checks on
targets. The default is HTTP.
Type: String
Default: HTTP
AllowedValues: ['TCP', 'HTTP', 'HTTPS']
ConstraintDescription: Must be a valid health check protocol
HealthPort:
Description: >-
The port the load balancer uses when performing health checks
on targets. For Gateway Load Balance specify port other then the
traffic port.
Type: String
Default: '80'
ConstraintDescription: Must be a valid health check port
VpcId:
Description: VPC Id to associate with target group. (e.g. vpc-a123baa3 )
Type: AWS::EC2::VPC::Id
ConstraintDescription: Must be a valid VPC Id
Appliance1InstanceId:
Description: Appliance1 instnace id to register with target group. (e.g. i-02aff411247212745 )
Type: AWS::EC2::Instance::Id
ConstraintDescription: Must be a valid EC2 instane id
Appliance2InstanceId:
Description: Appliance2 instnace id to register with target group. (e.g. i-02aff411247212745 )
Type: AWS::EC2::Instance::Id
ConstraintDescription: Must be a valid EC2 instane id
Resources:
Gwlb:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
Name: !Ref GwlbName
Type: gateway
Subnets: !Ref GwlbSubnets
TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
Name: !Ref TargetGroupName
Port: 6081
Protocol: GENEVE
HealthCheckPort: !Ref HealthPort
HealthCheckProtocol: !Ref HealthProtocol
TargetGroupAttributes:
- Key: deregistration_delay.timeout_seconds
Value: 20
VpcId: !Ref VpcId
TargetType: instance
Targets:
- Id: !Ref Appliance1InstanceId
- Id: !Ref Appliance2InstanceId
Tags:
- Key: Name
Value: !Join
- ""
- - !Ref AWS::StackName
- "-tg1"
Listener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
DefaultActions:
- Type: forward
TargetGroupArn: !Ref TargetGroup
LoadBalancerArn: !Ref Gwlb
Outputs:
SpGwlbArn:
Description: Service Provider Gwlb ARN
Value: !Ref Gwlb
SpTgArn:
Description: Service Provider Target Group ARN
Value: !Ref TargetGroup