@@ -314,6 +314,12 @@ describe('LaunchTemplate', () => {
314
314
} , {
315
315
deviceName : 'ephemeral' ,
316
316
volume : BlockDeviceVolume . ephemeral ( 0 ) ,
317
+ } , {
318
+ deviceName : 'gp3-with-throughput' ,
319
+ volume : BlockDeviceVolume . ebs ( 15 , {
320
+ volumeType : EbsDeviceVolumeType . GP3 ,
321
+ throughput : 350 ,
322
+ } ) ,
317
323
} ,
318
324
] ;
319
325
@@ -366,10 +372,60 @@ describe('LaunchTemplate', () => {
366
372
DeviceName : 'ephemeral' ,
367
373
VirtualName : 'ephemeral0' ,
368
374
} ,
375
+ {
376
+ DeviceName : 'gp3-with-throughput' ,
377
+ Ebs : {
378
+ VolumeSize : 15 ,
379
+ VolumeType : 'gp3' ,
380
+ Throughput : 350 ,
381
+ } ,
382
+ } ,
369
383
] ,
370
384
} ,
371
385
} ) ;
372
386
} ) ;
387
+ test . each ( [ 124 , 1001 ] ) ( 'throws if throughput is set less than 125 or more than 1000' , ( throughput ) => {
388
+ expect ( ( ) => {
389
+ new LaunchTemplate ( stack , 'LaunchTemplate' , {
390
+ blockDevices : [ {
391
+ deviceName : 'ebs' ,
392
+ volume : BlockDeviceVolume . ebs ( 15 , {
393
+ volumeType : EbsDeviceVolumeType . GP3 ,
394
+ throughput,
395
+ } ) ,
396
+ } ] ,
397
+ } ) ;
398
+ } ) . toThrow ( / t h r o u g h p u t p r o p e r t y t a k e s a m i n i m u m o f 1 2 5 a n d a m a x i m u m o f 1 0 0 0 / ) ;
399
+ } ) ;
400
+ test . each ( [
401
+ ...Object . values ( EbsDeviceVolumeType ) . filter ( ( v ) => v !== 'gp3' ) ,
402
+ ] ) ( 'throws if throughput is set on any volume type other than GP3' , ( volumeType ) => {
403
+ expect ( ( ) => {
404
+ new LaunchTemplate ( stack , 'LaunchTemplate' , {
405
+ blockDevices : [ {
406
+ deviceName : 'ebs' ,
407
+ volume : BlockDeviceVolume . ebs ( 15 , {
408
+ volumeType : volumeType ,
409
+ throughput : 150 ,
410
+ } ) ,
411
+ } ] ,
412
+ } ) ;
413
+ } ) . toThrow ( / t h r o u g h p u t p r o p e r t y r e q u i r e s v o l u m e T y p e : E b s D e v i c e V o l u m e T y p e .G P 3 / ) ;
414
+ } ) ;
415
+ test ( 'throws if throughput / iops ratio is greater than 0.25' , ( ) => {
416
+ expect ( ( ) => {
417
+ new LaunchTemplate ( stack , 'LaunchTemplate' , {
418
+ blockDevices : [ {
419
+ deviceName : 'ebs' ,
420
+ volume : BlockDeviceVolume . ebs ( 15 , {
421
+ volumeType : EbsDeviceVolumeType . GP3 ,
422
+ throughput : 751 ,
423
+ iops : 3000 ,
424
+ } ) ,
425
+ } ] ,
426
+ } ) ;
427
+ } ) . toThrow ( 'Throughput (MiBps) to iops ratio of 0.25033333333333335 is too high; maximum is 0.25 MiBps per iops' ) ;
428
+ } ) ;
373
429
374
430
test ( 'Given instance profile' , ( ) => {
375
431
// GIVEN
0 commit comments