-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathw2_assignment_1_alb.yml
More file actions
62 lines (58 loc) · 1.54 KB
/
w2_assignment_1_alb.yml
File metadata and controls
62 lines (58 loc) · 1.54 KB
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
Parameters:
BaseStackName:
Description: Please enter name of Base Stack
Type: String
Default: MyBase
InstanceStackName:
Description: Please enter name of Instance Stack
Type: String
Default: MyInstances
Resources:
TargetGroupLB:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
HealthCheckEnabled: true
HealthCheckPort: 3000
HealthCheckIntervalSeconds: 10
HealthCheckProtocol: TCP
UnhealthyThresholdCount: 3
Name: MyTargets
TargetType: instance
Protocol: TCP
Port: 3000
Targets:
- Id:
Fn::ImportValue:
!Sub "${InstanceStackName}:Webserver01"
- Id:
Fn::ImportValue:
!Sub '${InstanceStackName}:Webserver02'
Tags:
- Key: Name
Value: WebserverTG
VpcId:
Fn::ImportValue:
!Sub "${BaseStackName}:VPC"
LoadBalancer:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
Scheme: internet-facing
Type: network
Name: MyWebLoadbalancer
IpAddressType: ipv4
SubnetMappings:
- SubnetId:
Fn::ImportValue:
!Sub "${BaseStackName}:MyFirstSubnet"
- SubnetId:
Fn::ImportValue:
!Sub "${BaseStackName}:MySecondSubnet"
LoadBalancerListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
DefaultActions:
- Type: forward
TargetGroupArn: !Ref TargetGroupLB
LoadBalancerArn: !Ref LoadBalancer
Port: 3000
Protocol: TCP