Skip to content

Commit 0551153

Browse files
author
Varun Rao Bhamidimarri
committed
RDS security group ingress rules
1 parent 37d2863 commit 0551153

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

aws_emr_blog_v3/cloudformation/rds-database.template

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ Parameters:
1010
Subnet2:
1111
Description: ID of an existing subnet for the domain controller
1212
Type: AWS::EC2::Subnet::Id
13+
VPCCIDR:
14+
Description: VPC CIDR block
15+
Type: String
16+
MinLength: '9'
17+
MaxLength: '18'
18+
Default: 10.0.0.0/16
19+
AllowedPattern: (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2})
20+
ConstraintDescription: It must be a valid IP CIDR range of the form x.x.x.x/x.
21+
Suggest to enable access to your IP address only. Pls get your address using
22+
checkip.amazonaws.com or whatsmyip.org.
1323
ClientIP:
1424
Description: The IP address range that can be used to connect to the RDS instances
1525
and EC2 instance from your local machine.It must be a valid IP CIDR range of
@@ -76,9 +86,9 @@ Resources:
7686
ToPort: -1
7787
SecurityGroupIngress:
7888
- IpProtocol: tcp
79-
CidrIp: !Ref 'ClientIP'
80-
FromPort: '22'
81-
ToPort: '22'
89+
CidrIp: !Ref 'VPCCIDR'
90+
FromPort: '3306'
91+
ToPort: '3306'
8292
- IpProtocol: tcp
8393
CidrIp: !Ref 'ClientIP'
8494
FromPort: '3306'

aws_emr_blog_v3/cloudformation/step2_ranger-rds-emr.template

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,14 @@ Mappings:
351351
DefaultConfiguration:
352352
MachineConfiguration:
353353
BastionInstanceType: t2.small
354+
NetworkConfiguration:
355+
VPCCIDR: 10.0.0.0/16
356+
PublicSubnet1CIDR: 10.0.1.0/24
357+
PrivateSubnet1CIDR: 10.0.2.0/24
358+
PublicSubnet2CIDR: 10.0.3.0/24
359+
PrivateSubnet2CIDR: 10.0.4.0/24
360+
PublicSubnet3CIDR: 10.0.5.0/24
361+
PrivateSubnet3CIDR: 10.0.6.0/24
354362
Resources:
355363
RDSDatabase:
356364
Type: AWS::CloudFormation::Stack
@@ -363,7 +371,14 @@ Resources:
363371
- !Ref 'PrivateSubnet2AID'
364372
- !Ref AWS::NoValue
365373
VPC: !Ref VPC
366-
ClientIP: !Ref CIDRAccessToPrivateSubnetResources
374+
ClientIP: !FindInMap
375+
- DefaultConfiguration
376+
- NetworkConfiguration
377+
- PrivateSubnet1CIDR
378+
VPCCIDR: !FindInMap
379+
- DefaultConfiguration
380+
- NetworkConfiguration
381+
- VPCCIDR
367382
MySQLDBPassword: !Ref DBRootPassword
368383
MySQLDBUserName: !Ref DBUserName
369384
CopyS3Artifacts:

0 commit comments

Comments
 (0)