Skip to content

Commit a8d0a26

Browse files
New security group for Postgres access to registration db
Co-authored-by: Akash <akash1810@users.noreply.github.com>
1 parent 41801bf commit a8d0a26

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

registration-db.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ Resources:
4949
GroupName: !Sub registrations-db-${Stage}
5050
GroupDescription: !Sub Security group allowing VPC only traffic
5151
SecurityGroupIngress:
52+
# Join PostgresAccessSecurityGroup to allow access to postgres to the registration db
53+
- SourceSecurityGroupId: !Ref PostgresAccessSecurityGroup
54+
FromPort: 5432
55+
IpProtocol: tcp
56+
ToPort: 5432
57+
58+
# TODO Remove this rule once all applications are using the PostgresAccessSecurityGroup
5259
- SourceSecurityGroupId: !Ref VPCSecurityGroup
5360
FromPort: 5432
5461
IpProtocol: tcp
@@ -66,6 +73,27 @@ Resources:
6673
Value: registrations-db
6774
VpcId: !Ref VpcId
6875

76+
PostgresAccessSecurityGroup:
77+
Type: AWS::EC2::SecurityGroup
78+
Properties:
79+
GroupName: !Sub registrations-db-${Stage}-access
80+
GroupDescription: !Sub Security group allowing access to the registrations db
81+
Tags:
82+
- Key: Stage
83+
Value: !Ref Stage
84+
- Key: Stack
85+
Value: mobile-notifications
86+
- Key: App
87+
Value: registrations-db
88+
VpcId: !Ref VpcId
89+
90+
PostgresAccessSecurityGroupName:
91+
Type: AWS::SSM::Parameter
92+
Properties:
93+
Name: !Sub /${Stage}/mobile-notifications/registrations-db/postgres-access-security-group
94+
Type: String
95+
Value: !Ref PostgresAccessSecurityGroup
96+
6997
PrivateRegistrationPostgres13DB:
7098
Type: AWS::RDS::DBInstance
7199
DependsOn: PrivateRegistrationDBSubnetGroup
@@ -179,3 +207,4 @@ Resources:
179207
Outputs:
180208
DBUrl:
181209
Value: !GetAtt PrivateRegistrationPostgres13DB.Endpoint.Address
210+

0 commit comments

Comments
 (0)