@@ -7,7 +7,7 @@ import { IMachineImage, MachineImage } from './machine-image';
7
7
import { IPeer } from './peer' ;
8
8
import { Port } from './port' ;
9
9
import { ISecurityGroup } from './security-group' ;
10
- import { BlockDeviceVolume } from './volume' ;
10
+ import { BlockDevice } from './volume' ;
11
11
import { IVpc , SubnetSelection } from './vpc' ;
12
12
13
13
/**
@@ -67,12 +67,18 @@ export interface BastionHostLinuxProps {
67
67
readonly machineImage ?: IMachineImage ;
68
68
69
69
/**
70
- * Encryption for EBS volume
71
- * If true, encrypted volume will be created with a default voulme size of 10 GiB.
70
+ * Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.
72
71
*
73
- * @default false
72
+ * Each instance that is launched has an associated root device volume,
73
+ * either an Amazon EBS volume or an instance store volume.
74
+ * You can use block device mappings to specify additional EBS volumes or
75
+ * instance store volumes to attach to an instance when it is launched.
76
+ *
77
+ * @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html
78
+ *
79
+ * @default - Uses the block device mapping of the AMI
74
80
*/
75
- readonly ebsVolumeEncryption ?: boolean ;
81
+ readonly blockDevices ?: BlockDevice [ ] ;
76
82
}
77
83
78
84
/**
@@ -139,33 +145,16 @@ export class BastionHostLinux extends Construct implements IInstance {
139
145
super ( scope , id ) ;
140
146
this . stack = Stack . of ( scope ) ;
141
147
142
- if ( props . ebsVolumeEncryption ) {
143
- this . instance = new Instance ( this , 'Resource' , {
144
- vpc : props . vpc ,
145
- availabilityZone : props . availabilityZone ,
146
- securityGroup : props . securityGroup ,
147
- instanceName : props . instanceName ?? 'BastionHost' ,
148
- instanceType : props . instanceType ?? InstanceType . of ( InstanceClass . T3 , InstanceSize . NANO ) ,
149
- machineImage : props . machineImage ?? MachineImage . latestAmazonLinux ( { generation : AmazonLinuxGeneration . AMAZON_LINUX_2 } ) ,
150
- vpcSubnets : props . subnetSelection ?? { } ,
151
- blockDevices : [ {
152
- deviceName : 'EBSBastionHost' ,
153
- volume : BlockDeviceVolume . ebs ( 10 , {
154
- encrypted : props . ebsVolumeEncryption ?? false ,
155
- } ) ,
156
- } ] ,
157
- } ) ;
158
- } else {
159
- this . instance = new Instance ( this , 'Resource' , {
160
- vpc : props . vpc ,
161
- availabilityZone : props . availabilityZone ,
162
- securityGroup : props . securityGroup ,
163
- instanceName : props . instanceName ?? 'BastionHost' ,
164
- instanceType : props . instanceType ?? InstanceType . of ( InstanceClass . T3 , InstanceSize . NANO ) ,
165
- machineImage : props . machineImage ?? MachineImage . latestAmazonLinux ( { generation : AmazonLinuxGeneration . AMAZON_LINUX_2 } ) ,
166
- vpcSubnets : props . subnetSelection ?? { } ,
167
- } ) ;
168
- }
148
+ this . instance = new Instance ( this , 'Resource' , {
149
+ vpc : props . vpc ,
150
+ availabilityZone : props . availabilityZone ,
151
+ securityGroup : props . securityGroup ,
152
+ instanceName : props . instanceName ?? 'BastionHost' ,
153
+ instanceType : props . instanceType ?? InstanceType . of ( InstanceClass . T3 , InstanceSize . NANO ) ,
154
+ machineImage : props . machineImage ?? MachineImage . latestAmazonLinux ( { generation : AmazonLinuxGeneration . AMAZON_LINUX_2 } ) ,
155
+ vpcSubnets : props . subnetSelection ?? { } ,
156
+ blockDevices : props . blockDevices ?? undefined ,
157
+ } ) ;
169
158
this . instance . addToRolePolicy ( new PolicyStatement ( {
170
159
actions : [
171
160
'ssmmessages:*' ,
0 commit comments