-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2-SecurityGroups.yml
executable file
·114 lines (101 loc) · 3.28 KB
/
2-SecurityGroups.yml
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
Description: This script will create the security Group
Parameters:
EnvironmentName:
Description: An environment name that will be prefixed to resource names
Type: String
Default: PROD
Resources:
AppLoadBalancerSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId: !ImportValue VPCID
GroupDescription: Access to the load balancer that sits in front of ECS
SecurityGroupIngress:
# Allow access from anywhere to our ECS services
- CidrIp: 0.0.0.0/0
IpProtocol: tcp
FromPort: 80
ToPort: 80
Tags:
- Key: Name
Value: App-LoadBalancers-SecurityGroup
WebLoadBalancerSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId: !ImportValue VPCID
GroupDescription: Access to the load balancer that sits in front of ECS
SecurityGroupIngress:
- CidrIp: 0.0.0.0/0
IpProtocol: tcp
FromPort: 80
ToPort: 80
Tags:
- Key: Name
Value: Web-LoadBalancers-SecurityGroup
AppSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Allow http to client host
GroupName: ApplicationServerSecGrp
VpcId: !ImportValue VPCID
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
SourceSecurityGroupId: !Ref AppLoadBalancerSecurityGroup
Tags:
- Key: Name
Value: App-EC2-SecurityGroup
WebSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Allow http to client host
GroupName: WebServerSecGrp
VpcId: !ImportValue VPCID
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
SourceSecurityGroupId: !Ref WebLoadBalancerSecurityGroup
Tags:
- Key: Name
Value: Web-EC2-SecurityGroup
DatabaseSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId: !ImportValue VPCID
GroupDescription: Access to database
SecurityGroupIngress:
- SourceSecurityGroupId: !Ref AppSecurityGroup
FromPort: 3306
ToPort: 3306
IpProtocol: tcp
Tags:
- Key: Name
Value: DB-security-group
Outputs:
AppLoadBalancerSecurityGroup:
Description: AppLoadBalancerSecurityGroup
Value: !Ref AppLoadBalancerSecurityGroup
Export:
Name: AppLoadBalancerSecurityGroup
WebLoadBalancerSecurityGroup:
Description: WebLoadBalancerSecurityGroup
Value: !Ref WebLoadBalancerSecurityGroup
Export:
Name: WebLoadBalancerSecurityGroup
AppSecurityGroup:
Description: AppSecurityGroup
Value: !Ref AppSecurityGroup
Export:
Name: AppSecurityGroup
WebSecurityGroup:
Description: WebSecurityGroup
Value: !Ref WebSecurityGroup
Export:
Name: WebSecurityGroup
DatabaseSecurityGroup:
Description: DatabaseSecurityGroup
Value: !Ref DatabaseSecurityGroup
Export:
Name: DatabaseSecurityGroup