File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
PetAdoptions/cdk/pet_stack/lib Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -109,11 +109,20 @@ export class Services extends Stack {
109
109
// The VPC where all the microservices will be deployed into
110
110
const theVPC = new ec2 . Vpc ( this , 'Microservices' , {
111
111
ipAddresses : ec2 . IpAddresses . cidr ( cidrRange ) ,
112
- // cidr: cidrRange,
113
112
natGateways : 1 ,
114
113
maxAzs : 2
115
114
} ) ;
116
115
116
+ // Disable Map IP on launch for all public subnets
117
+ const publicSubnets = theVPC . selectSubnets ( {
118
+ subnetType : ec2 . SubnetType . PUBLIC ,
119
+ } ) ;
120
+
121
+ for ( const subnet of publicSubnets . subnets ) {
122
+ const cfnSubnet = subnet . node . defaultChild as ec2 . CfnSubnet ;
123
+ cfnSubnet . mapPublicIpOnLaunch = false ;
124
+ }
125
+
117
126
// Create RDS Aurora PG cluster
118
127
const rdssecuritygroup = new ec2 . SecurityGroup ( this , 'petadoptionsrdsSG' , {
119
128
vpc : theVPC
You can’t perform that action at this time.
0 commit comments