File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -131,10 +131,12 @@ export class BastionHost extends Construct {
131131 } ) ;
132132
133133 // Assign elastic IP
134- new ec2 . CfnEIP ( this , "IP" , {
135- instanceId : this . instance . instanceId ,
136- tags : [ { key : "Name" , value : stackName } ] ,
137- } ) ;
134+ if ( props . createElasticIp ) {
135+ new ec2 . CfnEIP ( this , "IP" , {
136+ instanceId : this . instance . instanceId ,
137+ tags : [ { key : "Name" , value : stackName } ] ,
138+ } ) ;
139+ }
138140
139141 // Allow bastion host to connect to db
140142 this . instance . connections . allowTo (
@@ -185,4 +187,11 @@ export interface BastionHostProps {
185187 readonly userData : ec2 . UserData ;
186188 readonly ipv4Allowlist : string [ ] ;
187189 readonly sshPort ?: number ;
190+
191+ /**
192+ * Whether or not an elastic IP should be created for the bastion host.
193+ *
194+ * @default true
195+ */
196+ readonly createElasticIp ?: boolean ;
188197}
You can’t perform that action at this time.
0 commit comments