aws-cdk-lib 2.75.1__py3-none-any.whl → 2.76.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of aws-cdk-lib might be problematic. Click here for more details.

Files changed (98) hide show
  1. aws_cdk/__init__.py +245 -259
  2. aws_cdk/_jsii/__init__.py +1 -1
  3. aws_cdk/_jsii/{aws-cdk-lib@2.75.1.jsii.tgz → aws-cdk-lib@2.76.0.jsii.tgz} +0 -0
  4. aws_cdk/aws_amplifyuibuilder/__init__.py +184 -216
  5. aws_cdk/aws_apigateway/__init__.py +95 -148
  6. aws_cdk/aws_appconfig/__init__.py +8 -4
  7. aws_cdk/aws_appflow/__init__.py +27 -52
  8. aws_cdk/aws_appmesh/__init__.py +91 -200
  9. aws_cdk/aws_apprunner/__init__.py +4 -16
  10. aws_cdk/aws_appstream/__init__.py +18 -82
  11. aws_cdk/aws_athena/__init__.py +18 -32
  12. aws_cdk/aws_backup/__init__.py +48 -86
  13. aws_cdk/aws_billingconductor/__init__.py +12 -7
  14. aws_cdk/aws_budgets/__init__.py +8 -17
  15. aws_cdk/aws_certificatemanager/__init__.py +7 -4
  16. aws_cdk/aws_cloudfront/__init__.py +14 -11
  17. aws_cdk/aws_cloudfront_origins/__init__.py +18 -8
  18. aws_cdk/aws_cloudtrail/__init__.py +7 -10
  19. aws_cdk/aws_cloudwatch/__init__.py +63 -35
  20. aws_cdk/aws_codebuild/__init__.py +10 -13
  21. aws_cdk/aws_codecommit/__init__.py +0 -1
  22. aws_cdk/aws_codedeploy/__init__.py +165 -162
  23. aws_cdk/aws_codepipeline/__init__.py +0 -4
  24. aws_cdk/aws_codepipeline_actions/__init__.py +16 -164
  25. aws_cdk/aws_cognito/__init__.py +195 -100
  26. aws_cdk/aws_config/__init__.py +28 -51
  27. aws_cdk/aws_connectcampaigns/__init__.py +5 -6
  28. aws_cdk/aws_databrew/__init__.py +5 -6
  29. aws_cdk/aws_dlm/__init__.py +33 -71
  30. aws_cdk/aws_docdb/__init__.py +20 -76
  31. aws_cdk/aws_dynamodb/__init__.py +7 -14
  32. aws_cdk/aws_ec2/__init__.py +1846 -421
  33. aws_cdk/aws_ecr/__init__.py +1 -2
  34. aws_cdk/aws_ecr_assets/__init__.py +27 -14
  35. aws_cdk/aws_ecs/__init__.py +241 -111
  36. aws_cdk/aws_ecs_patterns/__init__.py +13 -11
  37. aws_cdk/aws_eks/__init__.py +13 -8
  38. aws_cdk/aws_elasticloadbalancing/__init__.py +16 -9
  39. aws_cdk/aws_elasticloadbalancingv2/__init__.py +142 -82
  40. aws_cdk/aws_elasticloadbalancingv2_actions/__init__.py +126 -61
  41. aws_cdk/aws_elasticsearch/__init__.py +0 -7
  42. aws_cdk/aws_emr/__init__.py +7 -16
  43. aws_cdk/aws_emrserverless/__init__.py +14 -18
  44. aws_cdk/aws_events/__init__.py +33 -29
  45. aws_cdk/aws_events_targets/__init__.py +248 -89
  46. aws_cdk/aws_frauddetector/__init__.py +3 -4
  47. aws_cdk/aws_fsx/__init__.py +13 -7
  48. aws_cdk/aws_gamelift/__init__.py +11 -20
  49. aws_cdk/aws_iam/__init__.py +21 -25
  50. aws_cdk/aws_imagebuilder/__init__.py +58 -80
  51. aws_cdk/aws_iot/__init__.py +16 -10
  52. aws_cdk/aws_iotcoredeviceadvisor/__init__.py +16 -26
  53. aws_cdk/aws_iotevents/__init__.py +6 -4
  54. aws_cdk/aws_iotfleetwise/__init__.py +27 -40
  55. aws_cdk/aws_iotsitewise/__init__.py +8 -5
  56. aws_cdk/aws_kinesisfirehose/__init__.py +21 -38
  57. aws_cdk/aws_lambda/__init__.py +59 -48
  58. aws_cdk/aws_lambda_event_sources/__init__.py +6 -21
  59. aws_cdk/aws_logs/__init__.py +5 -7
  60. aws_cdk/aws_macie/__init__.py +22 -15
  61. aws_cdk/aws_mediaconnect/__init__.py +5 -8
  62. aws_cdk/aws_medialive/__init__.py +2 -4
  63. aws_cdk/aws_mediapackage/__init__.py +9 -18
  64. aws_cdk/aws_memorydb/__init__.py +5 -10
  65. aws_cdk/aws_mwaa/__init__.py +8 -4
  66. aws_cdk/aws_nimblestudio/__init__.py +25 -45
  67. aws_cdk/aws_opensearchservice/__init__.py +0 -1
  68. aws_cdk/aws_panorama/__init__.py +11 -12
  69. aws_cdk/aws_personalize/__init__.py +46 -72
  70. aws_cdk/aws_pinpoint/__init__.py +36 -65
  71. aws_cdk/aws_quicksight/__init__.py +9972 -13374
  72. aws_cdk/aws_rds/__init__.py +23 -22
  73. aws_cdk/aws_route53/__init__.py +8 -16
  74. aws_cdk/aws_route53_targets/__init__.py +2 -4
  75. aws_cdk/aws_s3/__init__.py +25 -85
  76. aws_cdk/aws_s3_notifications/__init__.py +0 -3
  77. aws_cdk/aws_sagemaker/__init__.py +6 -2
  78. aws_cdk/aws_secretsmanager/__init__.py +17 -14
  79. aws_cdk/aws_servicecatalog/__init__.py +58 -82
  80. aws_cdk/aws_servicediscovery/__init__.py +4 -6
  81. aws_cdk/aws_ses/__init__.py +21 -34
  82. aws_cdk/aws_sns/__init__.py +4 -8
  83. aws_cdk/aws_ssm/__init__.py +19 -23
  84. aws_cdk/aws_ssmcontacts/__init__.py +10 -6
  85. aws_cdk/aws_stepfunctions/__init__.py +3 -12
  86. aws_cdk/aws_stepfunctions_tasks/__init__.py +7 -12
  87. aws_cdk/aws_timestream/__init__.py +22 -28
  88. aws_cdk/aws_xray/__init__.py +15 -22
  89. aws_cdk/cloud_assembly_schema/__init__.py +14 -6
  90. aws_cdk/custom_resources/__init__.py +2 -3
  91. aws_cdk/pipelines/__init__.py +84 -134
  92. aws_cdk/triggers/__init__.py +46 -61
  93. {aws_cdk_lib-2.75.1.dist-info → aws_cdk_lib-2.76.0.dist-info}/METADATA +47 -92
  94. {aws_cdk_lib-2.75.1.dist-info → aws_cdk_lib-2.76.0.dist-info}/RECORD +98 -98
  95. {aws_cdk_lib-2.75.1.dist-info → aws_cdk_lib-2.76.0.dist-info}/LICENSE +0 -0
  96. {aws_cdk_lib-2.75.1.dist-info → aws_cdk_lib-2.76.0.dist-info}/NOTICE +0 -0
  97. {aws_cdk_lib-2.75.1.dist-info → aws_cdk_lib-2.76.0.dist-info}/WHEEL +0 -0
  98. {aws_cdk_lib-2.75.1.dist-info → aws_cdk_lib-2.76.0.dist-info}/top_level.txt +0 -0
@@ -15,7 +15,6 @@ network partitioning. This is achieved by creating an instance of
15
15
  `Vpc`:
16
16
 
17
17
  ```python
18
- # Example automatically generated from non-compiling source. May contain errors.
19
18
  vpc = ec2.Vpc(self, "VPC")
20
19
  ```
21
20
 
@@ -116,7 +115,6 @@ The example below will place the endpoint into two AZs (`us-east-1a` and `us-eas
116
115
  in Isolated subnets:
117
116
 
118
117
  ```python
119
- # Example automatically generated from non-compiling source. May contain errors.
120
118
  # vpc: ec2.Vpc
121
119
 
122
120
 
@@ -133,7 +131,6 @@ ec2.InterfaceVpcEndpoint(self, "VPC Endpoint",
133
131
  You can also specify specific subnet objects for granular control:
134
132
 
135
133
  ```python
136
- # Example automatically generated from non-compiling source. May contain errors.
137
134
  # vpc: ec2.Vpc
138
135
  # subnet1: ec2.Subnet
139
136
  # subnet2: ec2.Subnet
@@ -213,7 +210,6 @@ gets routed, pass a custom value for `defaultAllowedTraffic` and access the
213
210
  the VPC:
214
211
 
215
212
  ```python
216
- # Example automatically generated from non-compiling source. May contain errors.
217
213
  # instance_type: ec2.InstanceType
218
214
 
219
215
 
@@ -243,12 +239,11 @@ Be aware that if you don't explicitly reserve subnet groups in `subnetConfigurat
243
239
  Use `IpAddresses.cidr` to define a Cidr range for your Vpc directly in code:
244
240
 
245
241
  ```python
246
- # Example automatically generated from non-compiling source. May contain errors.
247
242
  from aws_cdk.aws_ec2 import IpAddresses
248
243
 
249
244
 
250
- ec2.Vpc(stack, "TheVPC",
251
- ip_addresses=ec2.IpAddresses.cidr("10.0.1.0/20")
245
+ ec2.Vpc(self, "TheVPC",
246
+ ip_addresses=IpAddresses.cidr("10.0.1.0/20")
252
247
  )
253
248
  ```
254
249
 
@@ -264,14 +259,13 @@ The argument to `IpAddresses.cidr` may not be a token, and concrete Cidr values
264
259
  Amazon VPC IP Address Manager (IPAM) manages a large IP space, from which chunks can be allocated for use in the Vpc. For information on Amazon VPC IP Address Manager please see the [official documentation](https://docs.aws.amazon.com/vpc/latest/ipam/what-it-is-ipam.html). An example of allocating from AWS IPAM looks like this:
265
260
 
266
261
  ```python
267
- # Example automatically generated from non-compiling source. May contain errors.
268
262
  from aws_cdk.aws_ec2 import IpAddresses
269
263
 
270
264
  # pool: ec2.CfnIPAMPool
271
265
 
272
266
 
273
- ec2.Vpc(stack, "TheVPC",
274
- ip_addresses=ec2.IpAddresses.aws_ipam_allocation(
267
+ ec2.Vpc(self, "TheVPC",
268
+ ip_addresses=IpAddresses.aws_ipam_allocation(
275
269
  ipv4_ipam_pool_id=pool.ref,
276
270
  ipv4_netmask_length=18,
277
271
  default_subnet_ipv4_netmask_length=24
@@ -297,7 +291,6 @@ space for reserving `n` availability zones can be done by setting the
297
291
  `reservedAzs` to `n` in vpc props, as shown below:
298
292
 
299
293
  ```python
300
- # Example automatically generated from non-compiling source. May contain errors.
301
294
  vpc = ec2.Vpc(self, "TheVPC",
302
295
  cidr="10.0.0.0/21",
303
296
  max_azs=3,
@@ -322,11 +315,10 @@ to configure the number and size of all subnets. Specifying an advanced
322
315
  subnet configuration could look like this:
323
316
 
324
317
  ```python
325
- # Example automatically generated from non-compiling source. May contain errors.
326
318
  vpc = ec2.Vpc(self, "TheVPC",
327
319
  # 'IpAddresses' configures the IP range and size of the entire VPC.
328
320
  # The IP space will be divided based on configuration for the subnets.
329
- ip_addresses=IpAddresses.cidr("10.0.0.0/21"),
321
+ ip_addresses=ec2.IpAddresses.cidr("10.0.0.0/21"),
330
322
 
331
323
  # 'maxAzs' configures the maximum number of availability zones to use.
332
324
  # If you want to specify the exact availability zones you want the VPC
@@ -394,7 +386,6 @@ DatabaseSubnet3 |`ISOLATED`|`10.0.6.32/28`|#3|Only routes within the VPC
394
386
  If you need access to the internet gateway, you can get its ID like so:
395
387
 
396
388
  ```python
397
- # Example automatically generated from non-compiling source. May contain errors.
398
389
  # vpc: ec2.Vpc
399
390
 
400
391
 
@@ -419,7 +410,6 @@ Internet Gateway created for the public subnet - perhaps for routing a VPN
419
410
  connection - you can do so like this:
420
411
 
421
412
  ```python
422
- # Example automatically generated from non-compiling source. May contain errors.
423
413
  vpc = ec2.Vpc(self, "VPC",
424
414
  subnet_configuration=[ec2.SubnetConfiguration(
425
415
  subnet_type=ec2.SubnetType.PUBLIC,
@@ -450,7 +440,6 @@ by setting the `reserved` subnetConfiguration property to true, as shown
450
440
  below:
451
441
 
452
442
  ```python
453
- # Example automatically generated from non-compiling source. May contain errors.
454
443
  vpc = ec2.Vpc(self, "TheVPC",
455
444
  nat_gateways=1,
456
445
  subnet_configuration=[ec2.SubnetConfiguration(
@@ -558,7 +547,6 @@ following limitations:
558
547
  Using `Vpc.fromVpcAttributes()` looks like this:
559
548
 
560
549
  ```python
561
- # Example automatically generated from non-compiling source. May contain errors.
562
550
  vpc = ec2.Vpc.from_vpc_attributes(self, "VPC",
563
551
  vpc_id="vpc-1234",
564
552
  availability_zones=["us-east-1a", "us-east-1b"],
@@ -582,7 +570,6 @@ lists to be zipped together to form `ISubnet` instances.
582
570
  Public subnet group example (for private or isolated subnet groups, use the properties with the respective prefix):
583
571
 
584
572
  ```python
585
- # Example automatically generated from non-compiling source. May contain errors.
586
573
  vpc = ec2.Vpc.from_vpc_attributes(self, "VPC",
587
574
  vpc_id="vpc-1234",
588
575
  availability_zones=["us-east-1a", "us-east-1b", "us-east-1c"],
@@ -632,7 +619,6 @@ and an **Ingress** rule to the other. The connections object will automatically
632
619
  take care of this for you:
633
620
 
634
621
  ```python
635
- # Example automatically generated from non-compiling source. May contain errors.
636
622
  # load_balancer: elbv2.ApplicationLoadBalancer
637
623
  # app_fleet: autoscaling.AutoScalingGroup
638
624
  # db_fleet: autoscaling.AutoScalingGroup
@@ -653,7 +639,6 @@ app_fleet.connections.allow_to(db_fleet, ec2.Port.tcp(443), "App can call databa
653
639
  There are various classes that implement the connection peer part:
654
640
 
655
641
  ```python
656
- # Example automatically generated from non-compiling source. May contain errors.
657
642
  # app_fleet: autoscaling.AutoScalingGroup
658
643
  # db_fleet: autoscaling.AutoScalingGroup
659
644
 
@@ -670,7 +655,6 @@ app_fleet.connections.allow_to(peer, ec2.Port.tcp(443), "Allow outbound HTTPS")
670
655
  Any object that has a security group can itself be used as a connection peer:
671
656
 
672
657
  ```python
673
- # Example automatically generated from non-compiling source. May contain errors.
674
658
  # fleet1: autoscaling.AutoScalingGroup
675
659
  # fleet2: autoscaling.AutoScalingGroup
676
660
  # app_fleet: autoscaling.AutoScalingGroup
@@ -688,7 +672,6 @@ The connections that are allowed are specified by port ranges. A number of class
688
672
  the connection specifier:
689
673
 
690
674
  ```python
691
- # Example automatically generated from non-compiling source. May contain errors.
692
675
  ec2.Port.tcp(80)
693
676
  ec2.Port.tcp_range(60000, 65535)
694
677
  ec2.Port.all_tcp()
@@ -714,7 +697,6 @@ If the object you're calling the peering method on has a default port associated
714
697
  For example:
715
698
 
716
699
  ```python
717
- # Example automatically generated from non-compiling source. May contain errors.
718
700
  # listener: elbv2.ApplicationListener
719
701
  # app_fleet: autoscaling.AutoScalingGroup
720
702
  # rds_database: rds.DatabaseCluster
@@ -753,7 +735,6 @@ my_security_group_without_inline_rules.add_ingress_rule(ec2.Peer.any_ipv4(), ec2
753
735
  If you know the ID and the configuration of the security group to import, you can use `SecurityGroup.fromSecurityGroupId`:
754
736
 
755
737
  ```python
756
- # Example automatically generated from non-compiling source. May contain errors.
757
738
  sg = ec2.SecurityGroup.from_security_group_id(self, "SecurityGroupImport", "sg-1234",
758
739
  allow_all_outbound=True
759
740
  )
@@ -768,7 +749,6 @@ sg = ec2.SecurityGroup.from_lookup_by_name(self, "SecurityGroupLookup", "securit
768
749
  If the security group ID is known and configuration details are unknown, use method `SecurityGroup.fromLookupById` instead. This method will lookup property `allowAllOutbound` from the current configuration of the security group.
769
750
 
770
751
  ```python
771
- # Example automatically generated from non-compiling source. May contain errors.
772
752
  sg = ec2.SecurityGroup.from_lookup_by_id(self, "SecurityGroupLookup", "sg-1234")
773
753
  ```
774
754
 
@@ -907,7 +887,6 @@ generic_windows = ec2.MachineImage.generic_windows({
907
887
  Create your VPC with VPN connections by specifying the `vpnConnections` props (keys are construct `id`s):
908
888
 
909
889
  ```python
910
- # Example automatically generated from non-compiling source. May contain errors.
911
890
  vpc = ec2.Vpc(self, "MyVpc",
912
891
  vpn_connections={
913
892
  "dynamic": ec2.VpnConnectionOptions( # Dynamic routing (BGP)
@@ -923,7 +902,6 @@ vpc = ec2.Vpc(self, "MyVpc",
923
902
  To create a VPC that can accept VPN connections, set `vpnGateway` to `true`:
924
903
 
925
904
  ```python
926
- # Example automatically generated from non-compiling source. May contain errors.
927
905
  vpc = ec2.Vpc(self, "MyVpc",
928
906
  vpn_gateway=True
929
907
  )
@@ -992,7 +970,6 @@ By default, CDK will place a VPC endpoint in one subnet per AZ. If you wish to o
992
970
  use the `subnets` parameter as follows:
993
971
 
994
972
  ```python
995
- # Example automatically generated from non-compiling source. May contain errors.
996
973
  # vpc: ec2.Vpc
997
974
 
998
975
 
@@ -1013,7 +990,6 @@ AZs an endpoint service is available in, and will ensure the VPC endpoint is not
1013
990
  These AZs will be stored in cdk.context.json.
1014
991
 
1015
992
  ```python
1016
- # Example automatically generated from non-compiling source. May contain errors.
1017
993
  # vpc: ec2.Vpc
1018
994
 
1019
995
 
@@ -1031,7 +1007,6 @@ create VPC endpoints without having to configure name, ports, etc. For example,
1031
1007
  use in your VPC:
1032
1008
 
1033
1009
  ```python
1034
- # Example automatically generated from non-compiling source. May contain errors.
1035
1010
  # vpc: ec2.Vpc
1036
1011
 
1037
1012
 
@@ -1049,7 +1024,6 @@ automatically allowed from the VPC CIDR.
1049
1024
  Use the `connections` object to allow traffic to flow to the endpoint:
1050
1025
 
1051
1026
  ```python
1052
- # Example automatically generated from non-compiling source. May contain errors.
1053
1027
  # my_endpoint: ec2.InterfaceVpcEndpoint
1054
1028
 
1055
1029
 
@@ -1063,7 +1037,6 @@ Alternatively, existing security groups can be used by specifying the `securityG
1063
1037
  A VPC endpoint service enables you to expose a Network Load Balancer(s) as a provider service to consumers, who connect to your service over a VPC endpoint. You can restrict access to your service via allowed principals (anything that extends ArnPrincipal), and require that new connections be manually accepted.
1064
1038
 
1065
1039
  ```python
1066
- # Example automatically generated from non-compiling source. May contain errors.
1067
1040
  # network_load_balancer1: elbv2.NetworkLoadBalancer
1068
1041
  # network_load_balancer2: elbv2.NetworkLoadBalancer
1069
1042
 
@@ -1079,7 +1052,6 @@ Endpoint services support private DNS, which makes it easier for clients to conn
1079
1052
  You can enable private DNS on an endpoint service like so:
1080
1053
 
1081
1054
  ```python
1082
- # Example automatically generated from non-compiling source. May contain errors.
1083
1055
  from aws_cdk.aws_route53 import HostedZone, VpcEndpointServiceDomainName
1084
1056
  # zone: HostedZone
1085
1057
  # vpces: ec2.VpcEndpointService
@@ -1173,29 +1145,19 @@ care of restarting your instance if it ever fails.
1173
1145
  # instance_type: ec2.InstanceType
1174
1146
 
1175
1147
 
1176
- # Amazon Linux 1
1177
- ec2.Instance(self, "Instance1",
1178
- vpc=vpc,
1179
- instance_type=instance_type,
1180
- machine_image=ec2.MachineImage.latest_amazon_linux()
1181
- )
1182
-
1183
1148
  # Amazon Linux 2
1184
1149
  ec2.Instance(self, "Instance2",
1185
1150
  vpc=vpc,
1186
1151
  instance_type=instance_type,
1187
- machine_image=ec2.MachineImage.latest_amazon_linux(
1188
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2
1189
- )
1152
+ machine_image=ec2.MachineImage.latest_amazon_linux2()
1190
1153
  )
1191
1154
 
1192
1155
  # Amazon Linux 2 with kernel 5.x
1193
1156
  ec2.Instance(self, "Instance3",
1194
1157
  vpc=vpc,
1195
1158
  instance_type=instance_type,
1196
- machine_image=ec2.MachineImage.latest_amazon_linux(
1197
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
1198
- kernel=ec2.AmazonLinuxKernel.KERNEL5_X
1159
+ machine_image=ec2.AmazonLinux2Image(
1160
+ kernel=ec2.AmazonLinux2Kernel.KERNEL_5_10
1199
1161
  )
1200
1162
  )
1201
1163
 
@@ -1203,22 +1165,122 @@ ec2.Instance(self, "Instance3",
1203
1165
  ec2.Instance(self, "Instance4",
1204
1166
  vpc=vpc,
1205
1167
  instance_type=instance_type,
1206
- machine_image=ec2.MachineImage.latest_amazon_linux(
1207
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2022
1208
- )
1168
+ machine_image=ec2.MachineImage.latest_amazon_linux2022()
1209
1169
  )
1210
1170
 
1211
1171
  # Graviton 3 Processor
1212
1172
  ec2.Instance(self, "Instance5",
1213
1173
  vpc=vpc,
1214
1174
  instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
1215
- machine_image=ec2.MachineImage.latest_amazon_linux(
1216
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
1175
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(
1217
1176
  cpu_type=ec2.AmazonLinuxCpuType.ARM_64
1218
1177
  )
1219
1178
  )
1220
1179
  ```
1221
1180
 
1181
+ ### Latest Amazon Linux Images
1182
+
1183
+ Rather than specifying a specific AMI ID to use, it is possible to specify a SSM
1184
+ Parameter that contains the AMI ID. AWS publishes a set of [public parameters](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-public-parameters-ami.html)
1185
+ that contain the latest Amazon Linux AMIs. To make it easier to query a
1186
+ particular image parameter, the CDK provides a couple of constructs `AmazonLinux2ImageSsmParameter`,
1187
+ `AmazonLinux2022ImageSsmParameter`, & `AmazonLinux2023SsmParameter`. For example
1188
+ to use the latest `al2023` image:
1189
+
1190
+ ```python
1191
+ # Example automatically generated from non-compiling source. May contain errors.
1192
+ ec2.Instance(self, "LatestAl2023",
1193
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
1194
+ machine_image=ec2.MachineImage.latest_amazon_linux2023()
1195
+ )
1196
+ ```
1197
+
1198
+ > **Warning**
1199
+ > Since this retrieves the value from an SSM parameter at deployment time, the
1200
+ > value will be resolved each time the stack is deployed. This means that if
1201
+ > the parameter contains a different value on your next deployment, the instance
1202
+ > will be replaced.
1203
+
1204
+ It is also possible to perform the lookup once at synthesis time and then cache
1205
+ the value in CDK context. This way the value will not change on future
1206
+ deployments unless you manually refresh the context.
1207
+
1208
+ ```python
1209
+ # Example automatically generated from non-compiling source. May contain errors.
1210
+ ec2.Instance(self, "LatestAl2023",
1211
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
1212
+ machine_image=ec2.MachineImage.latest_amazon_linux2023(
1213
+ cached_in_context=True
1214
+ )
1215
+ )
1216
+
1217
+ # or
1218
+ ec2.Instance(self, "LatestAl2023",
1219
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
1220
+ # context cache is turned on by default
1221
+ machine_image=ec2.AmazonLinux2023ImageSsmParameter()
1222
+ )
1223
+ ```
1224
+
1225
+ #### Kernel Versions
1226
+
1227
+ Each Amazon Linux AMI uses a specific kernel version. Most Amazon Linux
1228
+ generations come with an AMI using the "default" kernel and then 1 or more
1229
+ AMIs using a specific kernel version, which may or may not be different from the
1230
+ default kernel version.
1231
+
1232
+ For example, Amazon Linux 2 has two different AMIs available from the SSM
1233
+ parameters.
1234
+
1235
+ * `/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-ebs`
1236
+
1237
+ * This is the "default" kernel which uses `kernel-4.14`
1238
+ * `/aws/service/ami-amazon-linux-latest/amzn2-ami-kernel-5.10-hvm-x86_64-ebs`
1239
+
1240
+ If a new Amazon Linux generation AMI is published with a new kernel version,
1241
+ then a new SSM parameter will be created with the new version
1242
+ (e.g. `/aws/service/ami-amazon-linux-latest/amzn2-ami-kernel-5.15-hvm-x86_64-ebs`),
1243
+ but the "default" AMI may or may not be updated.
1244
+
1245
+ If you would like to make sure you always have the latest kernel version, then
1246
+ either specify the specific latest kernel version or opt-in to using the CDK
1247
+ latest kernel version.
1248
+
1249
+ ```python
1250
+ # Example automatically generated from non-compiling source. May contain errors.
1251
+ ec2.Instance(self, "LatestAl2023",
1252
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
1253
+ # context cache is turned on by default
1254
+ machine_image=ec2.AmazonLinux2023ImageSsmParameter(
1255
+ kernel=ec2.AmazonLinux2023Kernel.KERNEL_6_1
1256
+ )
1257
+ )
1258
+ ```
1259
+
1260
+ *CDK managed latest*
1261
+
1262
+ ```python
1263
+ # Example automatically generated from non-compiling source. May contain errors.
1264
+ ec2.Instance(self, "LatestAl2023",
1265
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
1266
+ # context cache is turned on by default
1267
+ machine_image=ec2.AmazonLinux2023ImageSsmParameter(
1268
+ kernel=ec2.AmazonLinux2023Kernel.CDK_LATEST
1269
+ )
1270
+ )
1271
+
1272
+ # or
1273
+
1274
+ ec2.Instance(self, "LatestAl2023",
1275
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
1276
+ machine_image=ec2.MachineImage.latest_amazon_linux2023()
1277
+ )
1278
+ ```
1279
+
1280
+ When using the CDK managed latest version, when a new kernel version is made
1281
+ available the `LATEST` will be updated to point to the new kernel version. You
1282
+ then would be required to update the newest CDK version for it to take effect.
1283
+
1222
1284
  ### Configuring Instances using CloudFormation Init (cfn-init)
1223
1285
 
1224
1286
  CloudFormation Init allows you to configure your instances by writing files to them, installing software
@@ -1231,7 +1293,6 @@ For the full set of capabilities of this system, see the documentation for
1231
1293
  Here is an example of applying some configuration to an instance:
1232
1294
 
1233
1295
  ```python
1234
- # Example automatically generated from non-compiling source. May contain errors.
1235
1296
  # vpc: ec2.Vpc
1236
1297
  # instance_type: ec2.InstanceType
1237
1298
  # machine_image: ec2.IMachineImage
@@ -1302,7 +1363,6 @@ start it immediately. The following examples shows how to start a trivial Python
1302
1363
  3 web server:
1303
1364
 
1304
1365
  ```python
1305
- # Example automatically generated from non-compiling source. May contain errors.
1306
1366
  # vpc: ec2.Vpc
1307
1367
  # instance_type: ec2.InstanceType
1308
1368
 
@@ -1310,12 +1370,9 @@ start it immediately. The following examples shows how to start a trivial Python
1310
1370
  ec2.Instance(self, "Instance",
1311
1371
  vpc=vpc,
1312
1372
  instance_type=instance_type,
1313
- machine_image=ec2.MachineImage.latest_amazon_linux(
1314
- # Amazon Linux 2 uses SystemD
1315
- generation=ec2.AmazonLinuxGeneration, AMAZON_LINUX_2=AMAZON_LINUX_2
1316
- ),
1373
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(),
1317
1374
 
1318
- init=ec2.CloudFormationInit.from_elements([
1375
+ init=ec2.CloudFormationInit.from_elements(
1319
1376
  # Create a simple config file that runs a Python web server
1320
1377
  ec2.InitService.systemd_config_file("simpleserver",
1321
1378
  command="/usr/bin/python3 -m http.server 8080",
@@ -1326,8 +1383,7 @@ ec2.Instance(self, "Instance",
1326
1383
  service_manager=ec2.ServiceManager.SYSTEMD
1327
1384
  ),
1328
1385
  # Drop an example file to show the web server working
1329
- ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!")
1330
- ])
1386
+ ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!"))
1331
1387
  )
1332
1388
  ```
1333
1389
 
@@ -1338,7 +1394,6 @@ config writes a config file for nginx, extracts an archive to the root directory
1338
1394
  restarts nginx so that it picks up the new config and files:
1339
1395
 
1340
1396
  ```python
1341
- # Example automatically generated from non-compiling source. May contain errors.
1342
1397
  # my_bucket: s3.Bucket
1343
1398
 
1344
1399
 
@@ -1398,7 +1453,6 @@ root device (`/dev/sda1`) size to 50 GiB, and adds another EBS-backed device map
1398
1453
  size:
1399
1454
 
1400
1455
  ```python
1401
- # Example automatically generated from non-compiling source. May contain errors.
1402
1456
  # vpc: ec2.Vpc
1403
1457
  # instance_type: ec2.InstanceType
1404
1458
  # machine_image: ec2.IMachineImage
@@ -1425,7 +1479,6 @@ ec2.Instance(self, "Instance",
1425
1479
  It is also possible to encrypt the block devices. In this example we will create an customer managed key encrypted EBS-backed root device:
1426
1480
 
1427
1481
  ```python
1428
- # Example automatically generated from non-compiling source. May contain errors.
1429
1482
  from aws_cdk.aws_kms import Key
1430
1483
 
1431
1484
  # vpc: ec2.Vpc
@@ -1462,7 +1515,6 @@ A notable restriction is that a Volume can only be attached to instances in the
1462
1515
  The following demonstrates how to create a 500 GiB encrypted Volume in the `us-west-2a` availability zone, and give a role the ability to attach that Volume to a specific instance:
1463
1516
 
1464
1517
  ```python
1465
- # Example automatically generated from non-compiling source. May contain errors.
1466
1518
  # instance: ec2.Instance
1467
1519
  # role: iam.Role
1468
1520
 
@@ -1482,7 +1534,6 @@ If you need to grant an instance the ability to attach/detach an EBS volume to/f
1482
1534
  will lead to an unresolvable circular reference between the instance role and the instance. In this case, use `grantAttachVolumeByResourceTag` and `grantDetachVolumeByResourceTag` as follows:
1483
1535
 
1484
1536
  ```python
1485
- # Example automatically generated from non-compiling source. May contain errors.
1486
1537
  # instance: ec2.Instance
1487
1538
  # volume: ec2.Volume
1488
1539
 
@@ -1501,7 +1552,6 @@ to attach and detach your Volumes to/from instances, and how to format them for
1501
1552
  The following is a sample skeleton of EC2 UserData that can be used to attach a Volume to the Linux instance that it is running on:
1502
1553
 
1503
1554
  ```python
1504
- # Example automatically generated from non-compiling source. May contain errors.
1505
1555
  # instance: ec2.Instance
1506
1556
  # volume: ec2.Volume
1507
1557
 
@@ -1516,7 +1566,6 @@ instance.user_data.add_commands("TOKEN=$(curl -SsfX PUT \"http://169.254.169.254
1516
1566
  You can configure [tag propagation on volume creation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-propagatetagstovolumeoncreation).
1517
1567
 
1518
1568
  ```python
1519
- # Example automatically generated from non-compiling source. May contain errors.
1520
1569
  # vpc: ec2.Vpc
1521
1570
  # instance_type: ec2.InstanceType
1522
1571
  # machine_image: ec2.IMachineImage
@@ -1535,11 +1584,10 @@ ec2.Instance(self, "Instance",
1535
1584
  You can specify the `throughput` of a GP3 volume from 125 (default) to 1000.
1536
1585
 
1537
1586
  ```python
1538
- # Example automatically generated from non-compiling source. May contain errors.
1539
1587
  ec2.Volume(self, "Volume",
1540
1588
  availability_zone="us-east-1a",
1541
- size=cdk.Size.gibibytes(125),
1542
- volume_type=EbsDeviceVolumeType.GP3,
1589
+ size=Size.gibibytes(125),
1590
+ volume_type=ec2.EbsDeviceVolumeType.GP3,
1543
1591
  throughput=125
1544
1592
  )
1545
1593
  ```
@@ -1555,7 +1603,6 @@ To do this for a single `Instance`, you can use the `requireImdsv2` property.
1555
1603
  The example below demonstrates IMDSv2 being required on a single `Instance`:
1556
1604
 
1557
1605
  ```python
1558
- # Example automatically generated from non-compiling source. May contain errors.
1559
1606
  # vpc: ec2.Vpc
1560
1607
  # instance_type: ec2.InstanceType
1561
1608
  # machine_image: ec2.IMachineImage
@@ -1578,7 +1625,6 @@ to apply the operation to multiple instances or launch templates, respectively.
1578
1625
  The following example demonstrates how to use the `InstanceRequireImdsv2Aspect` to require IMDSv2 for all EC2 instances in a stack:
1579
1626
 
1580
1627
  ```python
1581
- # Example automatically generated from non-compiling source. May contain errors.
1582
1628
  aspect = ec2.InstanceRequireImdsv2Aspect()
1583
1629
  Aspects.of(self).add(aspect)
1584
1630
  ```
@@ -1592,7 +1638,6 @@ By default, a flow log will be created with CloudWatch Logs as the destination.
1592
1638
  You can create a flow log like this:
1593
1639
 
1594
1640
  ```python
1595
- # Example automatically generated from non-compiling source. May contain errors.
1596
1641
  # vpc: ec2.Vpc
1597
1642
 
1598
1643
 
@@ -1604,7 +1649,6 @@ ec2.FlowLog(self, "FlowLog",
1604
1649
  Or you can add a Flow Log to a VPC by using the addFlowLog method like this:
1605
1650
 
1606
1651
  ```python
1607
- # Example automatically generated from non-compiling source. May contain errors.
1608
1652
  vpc = ec2.Vpc(self, "Vpc")
1609
1653
 
1610
1654
  vpc.add_flow_log("FlowLog")
@@ -1613,7 +1657,6 @@ vpc.add_flow_log("FlowLog")
1613
1657
  You can also add multiple flow logs with different destinations.
1614
1658
 
1615
1659
  ```python
1616
- # Example automatically generated from non-compiling source. May contain errors.
1617
1660
  vpc = ec2.Vpc(self, "Vpc")
1618
1661
 
1619
1662
  vpc.add_flow_log("FlowLogS3",
@@ -1623,7 +1666,7 @@ vpc.add_flow_log("FlowLogS3",
1623
1666
  # Only reject traffic and interval every minute.
1624
1667
  vpc.add_flow_log("FlowLogCloudWatch",
1625
1668
  traffic_type=ec2.FlowLogTrafficType.REJECT,
1626
- max_aggregation_interval=FlowLogMaxAggregationInterval.ONE_MINUTE
1669
+ max_aggregation_interval=ec2.FlowLogMaxAggregationInterval.ONE_MINUTE
1627
1670
  )
1628
1671
  ```
1629
1672
 
@@ -1632,7 +1675,6 @@ vpc.add_flow_log("FlowLogCloudWatch",
1632
1675
  You can also custom format flow logs.
1633
1676
 
1634
1677
  ```python
1635
- # Example automatically generated from non-compiling source. May contain errors.
1636
1678
  vpc = ec2.Vpc(self, "Vpc")
1637
1679
 
1638
1680
  vpc.add_flow_log("FlowLog",
@@ -1663,7 +1705,6 @@ If you want to customize any of the destination resources you can provide your o
1663
1705
  *CloudWatch Logs*
1664
1706
 
1665
1707
  ```python
1666
- # Example automatically generated from non-compiling source. May contain errors.
1667
1708
  # vpc: ec2.Vpc
1668
1709
 
1669
1710
 
@@ -1682,7 +1723,6 @@ ec2.FlowLog(self, "FlowLog",
1682
1723
  *S3*
1683
1724
 
1684
1725
  ```python
1685
- # Example automatically generated from non-compiling source. May contain errors.
1686
1726
  # vpc: ec2.Vpc
1687
1727
 
1688
1728
 
@@ -1721,7 +1761,6 @@ or you can use the UserData's convenience functions to aid in the creation of yo
1721
1761
  A user data could be configured to run a script found in an asset through the following:
1722
1762
 
1723
1763
  ```python
1724
- # Example automatically generated from non-compiling source. May contain errors.
1725
1764
  from aws_cdk.aws_s3_assets import Asset
1726
1765
 
1727
1766
  # instance: ec2.Instance
@@ -1752,8 +1791,7 @@ When creating a Windows UserData you can use the `persist` option to set whether
1752
1791
  `<persist>true</persist>` [to the user data script](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html#user-data-scripts). it can be used as follows:
1753
1792
 
1754
1793
  ```python
1755
- # Example automatically generated from non-compiling source. May contain errors.
1756
- windows_user_data = UserData.for_windows(persist=True)
1794
+ windows_user_data = ec2.UserData.for_windows(persist=True)
1757
1795
  ```
1758
1796
 
1759
1797
  For a Linux instance, this can be accomplished by using a Multipart user data to configure cloud-config as detailed
@@ -1780,7 +1818,6 @@ Below is an example for creating multipart user data with single body part respo
1780
1818
  of storage used by Docker containers:
1781
1819
 
1782
1820
  ```python
1783
- # Example automatically generated from non-compiling source. May contain errors.
1784
1821
  boot_hook_conf = ec2.UserData.for_linux()
1785
1822
  boot_hook_conf.add_commands("cloud-init-per once docker_options echo 'OPTIONS=\"${OPTIONS} --storage-opt dm.basesize=40G\"' >> /etc/sysconfig/docker")
1786
1823
 
@@ -1809,7 +1846,6 @@ to the `MultipartUserData` and designate it as the receiver for these methods. T
1809
1846
  method on `MultipartUserData` with the `makeDefault` argument set to `true`:
1810
1847
 
1811
1848
  ```python
1812
- # Example automatically generated from non-compiling source. May contain errors.
1813
1849
  multipart_user_data = ec2.MultipartUserData()
1814
1850
  commands_user_data = ec2.UserData.for_linux()
1815
1851
  multipart_user_data.add_user_data_part(commands_user_data, ec2.MultipartBody.SHELL_SCRIPT, True)
@@ -1832,7 +1868,6 @@ subnet per AZ).
1832
1868
  Importing an existing subnet looks like this:
1833
1869
 
1834
1870
  ```python
1835
- # Example automatically generated from non-compiling source. May contain errors.
1836
1871
  # Supply all properties
1837
1872
  subnet1 = ec2.Subnet.from_subnet_attributes(self, "SubnetFromAttributes",
1838
1873
  subnet_id="s-1234",
@@ -1855,14 +1890,11 @@ an instance. For information on Launch Templates please see the
1855
1890
  The following demonstrates how to create a launch template with an Amazon Machine Image, and security group.
1856
1891
 
1857
1892
  ```python
1858
- # Example automatically generated from non-compiling source. May contain errors.
1859
1893
  # vpc: ec2.Vpc
1860
1894
 
1861
1895
 
1862
1896
  template = ec2.LaunchTemplate(self, "LaunchTemplate",
1863
- machine_image=ec2.MachineImage.latest_amazon_linux(
1864
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2
1865
- ),
1897
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(),
1866
1898
  security_group=ec2.SecurityGroup(self, "LaunchTemplateSG",
1867
1899
  vpc=vpc
1868
1900
  )
@@ -1872,7 +1904,6 @@ template = ec2.LaunchTemplate(self, "LaunchTemplate",
1872
1904
  And the following demonstrates how to enable metadata options support.
1873
1905
 
1874
1906
  ```python
1875
- # Example automatically generated from non-compiling source. May contain errors.
1876
1907
  ec2.LaunchTemplate(self, "LaunchTemplate",
1877
1908
  http_endpoint=True,
1878
1909
  http_protocol_ipv6=True,
@@ -1887,7 +1918,6 @@ ec2.LaunchTemplate(self, "LaunchTemplate",
1887
1918
  The following demonstrates how to enable [Detailed Monitoring](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch-new.html) for an EC2 instance. Keep in mind that Detailed Monitoring results in [additional charges](http://aws.amazon.com/cloudwatch/pricing/).
1888
1919
 
1889
1920
  ```python
1890
- # Example automatically generated from non-compiling source. May contain errors.
1891
1921
  # vpc: ec2.Vpc
1892
1922
  # instance_type: ec2.InstanceType
1893
1923
 
@@ -1895,7 +1925,7 @@ The following demonstrates how to enable [Detailed Monitoring](https://docs.aws.
1895
1925
  ec2.Instance(self, "Instance1",
1896
1926
  vpc=vpc,
1897
1927
  instance_type=instance_type,
1898
- machine_image=ec2.MachineImage.latest_amazon_linux(),
1928
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(),
1899
1929
  detailed_monitoring=True
1900
1930
  )
1901
1931
  ```
@@ -1918,7 +1948,6 @@ To do so, you need to:
1918
1948
  If these conditions are met, you can connect to the instance from the EC2 Console. Example:
1919
1949
 
1920
1950
  ```python
1921
- # Example automatically generated from non-compiling source. May contain errors.
1922
1951
  # vpc: ec2.Vpc
1923
1952
  # instance_type: ec2.InstanceType
1924
1953
 
@@ -1928,9 +1957,7 @@ ec2.Instance(self, "Instance1",
1928
1957
  instance_type=instance_type,
1929
1958
 
1930
1959
  # Amazon Linux 2 comes with SSM Agent by default
1931
- machine_image=ec2.MachineImage.latest_amazon_linux(
1932
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2
1933
- ),
1960
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(),
1934
1961
 
1935
1962
  # Turn on SSM
1936
1963
  ssm_session_permissions=True
@@ -2566,7 +2593,6 @@ class AddRouteOptions:
2566
2593
 
2567
2594
  Example::
2568
2595
 
2569
- # Example automatically generated from non-compiling source. May contain errors.
2570
2596
  vpc = ec2.Vpc(self, "VPC",
2571
2597
  subnet_configuration=[ec2.SubnetConfiguration(
2572
2598
  subnet_type=ec2.SubnetType.PUBLIC,
@@ -2786,6 +2812,208 @@ class AllocatedSubnet:
2786
2812
  )
2787
2813
 
2788
2814
 
2815
+ class AmazonLinux2022Kernel(
2816
+ metaclass=jsii.JSIIMeta,
2817
+ jsii_type="aws-cdk-lib.aws_ec2.AmazonLinux2022Kernel",
2818
+ ):
2819
+ '''Amazon Linux 2022 kernel versions.
2820
+
2821
+ :exampleMetadata: fixture=_generated
2822
+
2823
+ Example::
2824
+
2825
+ # The code below shows an example of how to instantiate this type.
2826
+ # The values are placeholders you should change.
2827
+ from aws_cdk import aws_ec2 as ec2
2828
+
2829
+ amazon_linux2022_kernel = ec2.AmazonLinux2022Kernel.CDK_LATEST
2830
+ '''
2831
+
2832
+ def __init__(self, version: builtins.str) -> None:
2833
+ '''
2834
+ :param version: -
2835
+ '''
2836
+ if __debug__:
2837
+ type_hints = typing.get_type_hints(_typecheckingstub__67731f51c6dad8d404e1a6ed177e5a2605da4ce360058d786cf253f72d1aee3d)
2838
+ check_type(argname="argument version", value=version, expected_type=type_hints["version"])
2839
+ jsii.create(self.__class__, self, [version])
2840
+
2841
+ @jsii.member(jsii_name="toString")
2842
+ def to_string(self) -> builtins.str:
2843
+ '''Generate a string representation of the kernel.'''
2844
+ return typing.cast(builtins.str, jsii.invoke(self, "toString", []))
2845
+
2846
+ @jsii.python.classproperty
2847
+ @jsii.member(jsii_name="CDK_LATEST")
2848
+ def CDK_LATEST(cls) -> "AmazonLinux2022Kernel":
2849
+ '''The latest kernel version currently available in a published AMI.
2850
+
2851
+ When a new kernel version is available for an al2022 AMI this will be
2852
+ updated to contain the latest kernel version and will cause your instances
2853
+ to be replaced. Do not store stateful information on the instance if you are
2854
+ using this version.
2855
+ '''
2856
+ return typing.cast("AmazonLinux2022Kernel", jsii.sget(cls, "CDK_LATEST"))
2857
+
2858
+ @jsii.python.classproperty
2859
+ @jsii.member(jsii_name="DEFAULT")
2860
+ def DEFAULT(cls) -> "AmazonLinux2022Kernel":
2861
+ '''The default kernel version for Amazon Linux 2022 is 5.15 and the SSM parameter does not include it in the name (i.e. /aws/service/ami-amazon-linux-latest/amzn2022-ami-kernel-default-x86_64).'''
2862
+ return typing.cast("AmazonLinux2022Kernel", jsii.sget(cls, "DEFAULT"))
2863
+
2864
+ @jsii.python.classproperty
2865
+ @jsii.member(jsii_name="KERNEL_5_15")
2866
+ def KERNEL_5_15(cls) -> "AmazonLinux2022Kernel":
2867
+ '''Kernel version 5.15.'''
2868
+ return typing.cast("AmazonLinux2022Kernel", jsii.sget(cls, "KERNEL_5_15"))
2869
+
2870
+
2871
+ class AmazonLinux2023Kernel(
2872
+ metaclass=jsii.JSIIMeta,
2873
+ jsii_type="aws-cdk-lib.aws_ec2.AmazonLinux2023Kernel",
2874
+ ):
2875
+ '''Amazon Linux 2023 kernel versions.
2876
+
2877
+ :exampleMetadata: infused
2878
+
2879
+ Example::
2880
+
2881
+ # Example automatically generated from non-compiling source. May contain errors.
2882
+ ec2.Instance(self, "LatestAl2023",
2883
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
2884
+ # context cache is turned on by default
2885
+ machine_image=ec2.AmazonLinux2023ImageSsmParameter(
2886
+ kernel=ec2.AmazonLinux2023Kernel.KERNEL_6_1
2887
+ )
2888
+ )
2889
+ '''
2890
+
2891
+ def __init__(self, version: builtins.str) -> None:
2892
+ '''
2893
+ :param version: -
2894
+ '''
2895
+ if __debug__:
2896
+ type_hints = typing.get_type_hints(_typecheckingstub__0ab727190b8ad0e28c2d1ddc702af61630c845ff5aedd9578b75429a06aba8f5)
2897
+ check_type(argname="argument version", value=version, expected_type=type_hints["version"])
2898
+ jsii.create(self.__class__, self, [version])
2899
+
2900
+ @jsii.member(jsii_name="toString")
2901
+ def to_string(self) -> builtins.str:
2902
+ '''Generate a string representation of the kernel.'''
2903
+ return typing.cast(builtins.str, jsii.invoke(self, "toString", []))
2904
+
2905
+ @jsii.python.classproperty
2906
+ @jsii.member(jsii_name="CDK_LATEST")
2907
+ def CDK_LATEST(cls) -> "AmazonLinux2023Kernel":
2908
+ '''The latest kernel version currently available in a published AMI.
2909
+
2910
+ When a new kernel version is available for an al2023 AMI this will be
2911
+ updated to contain the latest kernel version and will cause your instances
2912
+ to be replaced. Do not store stateful information on the instance if you are
2913
+ using this version.
2914
+ '''
2915
+ return typing.cast("AmazonLinux2023Kernel", jsii.sget(cls, "CDK_LATEST"))
2916
+
2917
+ @jsii.python.classproperty
2918
+ @jsii.member(jsii_name="DEFAULT")
2919
+ def DEFAULT(cls) -> "AmazonLinux2023Kernel":
2920
+ '''The default kernel version for Amazon Linux 2023 is 6.1 and the SSM parameter does not include it in the name (i.e. /aws/service/ami-amazon-linux-latest/amzn2023-ami-kernel-default-x86_64).'''
2921
+ return typing.cast("AmazonLinux2023Kernel", jsii.sget(cls, "DEFAULT"))
2922
+
2923
+ @jsii.python.classproperty
2924
+ @jsii.member(jsii_name="KERNEL_6_1")
2925
+ def KERNEL_6_1(cls) -> "AmazonLinux2023Kernel":
2926
+ '''Kernel version 6.1.'''
2927
+ return typing.cast("AmazonLinux2023Kernel", jsii.sget(cls, "KERNEL_6_1"))
2928
+
2929
+
2930
+ class AmazonLinux2Kernel(
2931
+ metaclass=jsii.JSIIMeta,
2932
+ jsii_type="aws-cdk-lib.aws_ec2.AmazonLinux2Kernel",
2933
+ ):
2934
+ '''Amazon Linux 2 kernel versions.
2935
+
2936
+ :exampleMetadata: infused
2937
+
2938
+ Example::
2939
+
2940
+ # Example automatically generated from non-compiling source. May contain errors.
2941
+ # vpc: ec2.Vpc
2942
+ # instance_type: ec2.InstanceType
2943
+
2944
+
2945
+ # Amazon Linux 2
2946
+ ec2.Instance(self, "Instance2",
2947
+ vpc=vpc,
2948
+ instance_type=instance_type,
2949
+ machine_image=ec2.MachineImage.latest_amazon_linux2()
2950
+ )
2951
+
2952
+ # Amazon Linux 2 with kernel 5.x
2953
+ ec2.Instance(self, "Instance3",
2954
+ vpc=vpc,
2955
+ instance_type=instance_type,
2956
+ machine_image=ec2.AmazonLinux2Image(
2957
+ kernel=ec2.AmazonLinux2Kernel.KERNEL_5_10
2958
+ )
2959
+ )
2960
+
2961
+ # AWS Linux 2022
2962
+ ec2.Instance(self, "Instance4",
2963
+ vpc=vpc,
2964
+ instance_type=instance_type,
2965
+ machine_image=ec2.MachineImage.latest_amazon_linux2022()
2966
+ )
2967
+
2968
+ # Graviton 3 Processor
2969
+ ec2.Instance(self, "Instance5",
2970
+ vpc=vpc,
2971
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
2972
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(
2973
+ cpu_type=ec2.AmazonLinuxCpuType.ARM_64
2974
+ )
2975
+ )
2976
+ '''
2977
+
2978
+ def __init__(self, version: builtins.str) -> None:
2979
+ '''
2980
+ :param version: -
2981
+ '''
2982
+ if __debug__:
2983
+ type_hints = typing.get_type_hints(_typecheckingstub__3d9d80aebc17990a8f3419f9444ec1fdd3e5bc1c150c3db0d42eda409806c7a8)
2984
+ check_type(argname="argument version", value=version, expected_type=type_hints["version"])
2985
+ jsii.create(self.__class__, self, [version])
2986
+
2987
+ @jsii.member(jsii_name="toString")
2988
+ def to_string(self) -> typing.Optional[builtins.str]:
2989
+ '''Generate a string representation of the kernel.'''
2990
+ return typing.cast(typing.Optional[builtins.str], jsii.invoke(self, "toString", []))
2991
+
2992
+ @jsii.python.classproperty
2993
+ @jsii.member(jsii_name="CDK_LATEST")
2994
+ def CDK_LATEST(cls) -> "AmazonLinux2Kernel":
2995
+ '''The latest kernel version currently available in a published AMI.
2996
+
2997
+ When a new kernel version is available for an amzn2 AMI this will be
2998
+ updated to contain the latest kernel version and will cause your instances
2999
+ to be replaced. Do not store stateful information on the instance if you are
3000
+ using this version.
3001
+ '''
3002
+ return typing.cast("AmazonLinux2Kernel", jsii.sget(cls, "CDK_LATEST"))
3003
+
3004
+ @jsii.python.classproperty
3005
+ @jsii.member(jsii_name="DEFAULT")
3006
+ def DEFAULT(cls) -> "AmazonLinux2Kernel":
3007
+ '''The default kernel version for Amazon Linux 2 is 4.14 and Linux 4.14.311-233.529.amzn2.x86_64 the SSM parameter does not include it in the name (i.e. /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2).'''
3008
+ return typing.cast("AmazonLinux2Kernel", jsii.sget(cls, "DEFAULT"))
3009
+
3010
+ @jsii.python.classproperty
3011
+ @jsii.member(jsii_name="KERNEL_5_10")
3012
+ def KERNEL_5_10(cls) -> "AmazonLinux2Kernel":
3013
+ '''Kernel version 5.10.'''
3014
+ return typing.cast("AmazonLinux2Kernel", jsii.sget(cls, "KERNEL_5_10"))
3015
+
3016
+
2789
3017
  @jsii.enum(jsii_type="aws-cdk-lib.aws_ec2.AmazonLinuxCpuType")
2790
3018
  class AmazonLinuxCpuType(enum.Enum):
2791
3019
  '''CPU type.
@@ -2902,6 +3130,8 @@ class AmazonLinuxGeneration(enum.Enum):
2902
3130
  '''Amazon Linux 2.'''
2903
3131
  AMAZON_LINUX_2022 = "AMAZON_LINUX_2022"
2904
3132
  '''Amazon Linux 2022.'''
3133
+ AMAZON_LINUX_2023 = "AMAZON_LINUX_2023"
3134
+ '''Amazon Linux 2023.'''
2905
3135
 
2906
3136
 
2907
3137
  @jsii.data_type(
@@ -2946,33 +3176,19 @@ class AmazonLinuxImageProps:
2946
3176
 
2947
3177
  Example::
2948
3178
 
2949
- # Example automatically generated from non-compiling source. May contain errors.
2950
- # vpc: ec2.Vpc
2951
- # instance_type: ec2.InstanceType
3179
+ # vpc: ec2.IVpc
2952
3180
 
3181
+ lb = elb.LoadBalancer(self, "LB",
3182
+ vpc=vpc
3183
+ )
2953
3184
 
2954
- ec2.Instance(self, "Instance",
3185
+ # instance to add as the target for load balancer.
3186
+ instance = ec2.Instance(self, "targetInstance",
2955
3187
  vpc=vpc,
2956
- instance_type=instance_type,
2957
- machine_image=ec2.MachineImage.latest_amazon_linux(
2958
- # Amazon Linux 2 uses SystemD
2959
- generation=ec2.AmazonLinuxGeneration, AMAZON_LINUX_2=AMAZON_LINUX_2
2960
- ),
2961
-
2962
- init=ec2.CloudFormationInit.from_elements([
2963
- # Create a simple config file that runs a Python web server
2964
- ec2.InitService.systemd_config_file("simpleserver",
2965
- command="/usr/bin/python3 -m http.server 8080",
2966
- cwd="/var/www/html"
2967
- ),
2968
- # Start the server using SystemD
2969
- ec2.InitService.enable("simpleserver",
2970
- service_manager=ec2.ServiceManager.SYSTEMD
2971
- ),
2972
- # Drop an example file to show the web server working
2973
- ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!")
2974
- ])
3188
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO),
3189
+ machine_image=ec2.AmazonLinuxImage(generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2)
2975
3190
  )
3191
+ lb.add_target(elb.InstanceTarget(instance))
2976
3192
  '''
2977
3193
  if __debug__:
2978
3194
  type_hints = typing.get_type_hints(_typecheckingstub__dd95a518c06563a07debc9bf1ca51713b747cf64bded6f7cc81a28680d7ea9fc)
@@ -3029,7 +3245,366 @@ class AmazonLinuxImageProps:
3029
3245
  def cpu_type(self) -> typing.Optional[AmazonLinuxCpuType]:
3030
3246
  '''CPU Type.
3031
3247
 
3032
- :default: X86_64
3248
+ :default: X86_64
3249
+ '''
3250
+ result = self._values.get("cpu_type")
3251
+ return typing.cast(typing.Optional[AmazonLinuxCpuType], result)
3252
+
3253
+ @builtins.property
3254
+ def edition(self) -> typing.Optional[AmazonLinuxEdition]:
3255
+ '''What edition of Amazon Linux to use.
3256
+
3257
+ :default: Standard
3258
+ '''
3259
+ result = self._values.get("edition")
3260
+ return typing.cast(typing.Optional[AmazonLinuxEdition], result)
3261
+
3262
+ @builtins.property
3263
+ def generation(self) -> typing.Optional[AmazonLinuxGeneration]:
3264
+ '''What generation of Amazon Linux to use.
3265
+
3266
+ :default: AmazonLinux
3267
+ '''
3268
+ result = self._values.get("generation")
3269
+ return typing.cast(typing.Optional[AmazonLinuxGeneration], result)
3270
+
3271
+ @builtins.property
3272
+ def kernel(self) -> typing.Optional["AmazonLinuxKernel"]:
3273
+ '''What kernel version of Amazon Linux to use.
3274
+
3275
+ :default: -
3276
+ '''
3277
+ result = self._values.get("kernel")
3278
+ return typing.cast(typing.Optional["AmazonLinuxKernel"], result)
3279
+
3280
+ @builtins.property
3281
+ def storage(self) -> typing.Optional["AmazonLinuxStorage"]:
3282
+ '''What storage backed image to use.
3283
+
3284
+ :default: GeneralPurpose
3285
+ '''
3286
+ result = self._values.get("storage")
3287
+ return typing.cast(typing.Optional["AmazonLinuxStorage"], result)
3288
+
3289
+ @builtins.property
3290
+ def user_data(self) -> typing.Optional["UserData"]:
3291
+ '''Initial user data.
3292
+
3293
+ :default: - Empty UserData for Linux machines
3294
+ '''
3295
+ result = self._values.get("user_data")
3296
+ return typing.cast(typing.Optional["UserData"], result)
3297
+
3298
+ @builtins.property
3299
+ def virtualization(self) -> typing.Optional["AmazonLinuxVirt"]:
3300
+ '''Virtualization type.
3301
+
3302
+ :default: HVM
3303
+ '''
3304
+ result = self._values.get("virtualization")
3305
+ return typing.cast(typing.Optional["AmazonLinuxVirt"], result)
3306
+
3307
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
3308
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
3309
+
3310
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
3311
+ return not (rhs == self)
3312
+
3313
+ def __repr__(self) -> str:
3314
+ return "AmazonLinuxImageProps(%s)" % ", ".join(
3315
+ k + "=" + repr(v) for k, v in self._values.items()
3316
+ )
3317
+
3318
+
3319
+ @jsii.data_type(
3320
+ jsii_type="aws-cdk-lib.aws_ec2.AmazonLinuxImageSsmParameterBaseOptions",
3321
+ jsii_struct_bases=[],
3322
+ name_mapping={"cached_in_context": "cachedInContext", "user_data": "userData"},
3323
+ )
3324
+ class AmazonLinuxImageSsmParameterBaseOptions:
3325
+ def __init__(
3326
+ self,
3327
+ *,
3328
+ cached_in_context: typing.Optional[builtins.bool] = None,
3329
+ user_data: typing.Optional["UserData"] = None,
3330
+ ) -> None:
3331
+ '''Base options for amazon linux ssm parameters.
3332
+
3333
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
3334
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
3335
+
3336
+ :exampleMetadata: fixture=_generated
3337
+
3338
+ Example::
3339
+
3340
+ # The code below shows an example of how to instantiate this type.
3341
+ # The values are placeholders you should change.
3342
+ from aws_cdk import aws_ec2 as ec2
3343
+
3344
+ # user_data: ec2.UserData
3345
+
3346
+ amazon_linux_image_ssm_parameter_base_options = ec2.AmazonLinuxImageSsmParameterBaseOptions(
3347
+ cached_in_context=False,
3348
+ user_data=user_data
3349
+ )
3350
+ '''
3351
+ if __debug__:
3352
+ type_hints = typing.get_type_hints(_typecheckingstub__08eb71b09afb1d361b3f043a5c2d7d4be91f84b114302afefc8a69963ee6333f)
3353
+ check_type(argname="argument cached_in_context", value=cached_in_context, expected_type=type_hints["cached_in_context"])
3354
+ check_type(argname="argument user_data", value=user_data, expected_type=type_hints["user_data"])
3355
+ self._values: typing.Dict[builtins.str, typing.Any] = {}
3356
+ if cached_in_context is not None:
3357
+ self._values["cached_in_context"] = cached_in_context
3358
+ if user_data is not None:
3359
+ self._values["user_data"] = user_data
3360
+
3361
+ @builtins.property
3362
+ def cached_in_context(self) -> typing.Optional[builtins.bool]:
3363
+ '''Whether the AMI ID is cached to be stable between deployments.
3364
+
3365
+ By default, the newest image is used on each deployment. This will cause
3366
+ instances to be replaced whenever a new version is released, and may cause
3367
+ downtime if there aren't enough running instances in the AutoScalingGroup
3368
+ to reschedule the tasks on.
3369
+
3370
+ If set to true, the AMI ID will be cached in ``cdk.context.json`` and the
3371
+ same value will be used on future runs. Your instances will not be replaced
3372
+ but your AMI version will grow old over time. To refresh the AMI lookup,
3373
+ you will have to evict the value from the cache using the ``cdk context``
3374
+ command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
3375
+ more information.
3376
+
3377
+ Can not be set to ``true`` in environment-agnostic stacks.
3378
+
3379
+ :default: false
3380
+ '''
3381
+ result = self._values.get("cached_in_context")
3382
+ return typing.cast(typing.Optional[builtins.bool], result)
3383
+
3384
+ @builtins.property
3385
+ def user_data(self) -> typing.Optional["UserData"]:
3386
+ '''Initial user data.
3387
+
3388
+ :default: - Empty UserData for Linux machines
3389
+ '''
3390
+ result = self._values.get("user_data")
3391
+ return typing.cast(typing.Optional["UserData"], result)
3392
+
3393
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
3394
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
3395
+
3396
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
3397
+ return not (rhs == self)
3398
+
3399
+ def __repr__(self) -> str:
3400
+ return "AmazonLinuxImageSsmParameterBaseOptions(%s)" % ", ".join(
3401
+ k + "=" + repr(v) for k, v in self._values.items()
3402
+ )
3403
+
3404
+
3405
+ @jsii.data_type(
3406
+ jsii_type="aws-cdk-lib.aws_ec2.AmazonLinuxImageSsmParameterBaseProps",
3407
+ jsii_struct_bases=[AmazonLinuxImageSsmParameterBaseOptions],
3408
+ name_mapping={
3409
+ "cached_in_context": "cachedInContext",
3410
+ "user_data": "userData",
3411
+ "parameter_name": "parameterName",
3412
+ },
3413
+ )
3414
+ class AmazonLinuxImageSsmParameterBaseProps(AmazonLinuxImageSsmParameterBaseOptions):
3415
+ def __init__(
3416
+ self,
3417
+ *,
3418
+ cached_in_context: typing.Optional[builtins.bool] = None,
3419
+ user_data: typing.Optional["UserData"] = None,
3420
+ parameter_name: builtins.str,
3421
+ ) -> None:
3422
+ '''Base properties for an Amazon Linux SSM Parameter.
3423
+
3424
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
3425
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
3426
+ :param parameter_name: The name of the SSM parameter that contains the AMI value.
3427
+
3428
+ :exampleMetadata: fixture=_generated
3429
+
3430
+ Example::
3431
+
3432
+ # The code below shows an example of how to instantiate this type.
3433
+ # The values are placeholders you should change.
3434
+ from aws_cdk import aws_ec2 as ec2
3435
+
3436
+ # user_data: ec2.UserData
3437
+
3438
+ amazon_linux_image_ssm_parameter_base_props = ec2.AmazonLinuxImageSsmParameterBaseProps(
3439
+ parameter_name="parameterName",
3440
+
3441
+ # the properties below are optional
3442
+ cached_in_context=False,
3443
+ user_data=user_data
3444
+ )
3445
+ '''
3446
+ if __debug__:
3447
+ type_hints = typing.get_type_hints(_typecheckingstub__78a32cfc14171e780d6e44d3e6a99faa6da50655ac09560f7b229b0c0c7383f1)
3448
+ check_type(argname="argument cached_in_context", value=cached_in_context, expected_type=type_hints["cached_in_context"])
3449
+ check_type(argname="argument user_data", value=user_data, expected_type=type_hints["user_data"])
3450
+ check_type(argname="argument parameter_name", value=parameter_name, expected_type=type_hints["parameter_name"])
3451
+ self._values: typing.Dict[builtins.str, typing.Any] = {
3452
+ "parameter_name": parameter_name,
3453
+ }
3454
+ if cached_in_context is not None:
3455
+ self._values["cached_in_context"] = cached_in_context
3456
+ if user_data is not None:
3457
+ self._values["user_data"] = user_data
3458
+
3459
+ @builtins.property
3460
+ def cached_in_context(self) -> typing.Optional[builtins.bool]:
3461
+ '''Whether the AMI ID is cached to be stable between deployments.
3462
+
3463
+ By default, the newest image is used on each deployment. This will cause
3464
+ instances to be replaced whenever a new version is released, and may cause
3465
+ downtime if there aren't enough running instances in the AutoScalingGroup
3466
+ to reschedule the tasks on.
3467
+
3468
+ If set to true, the AMI ID will be cached in ``cdk.context.json`` and the
3469
+ same value will be used on future runs. Your instances will not be replaced
3470
+ but your AMI version will grow old over time. To refresh the AMI lookup,
3471
+ you will have to evict the value from the cache using the ``cdk context``
3472
+ command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
3473
+ more information.
3474
+
3475
+ Can not be set to ``true`` in environment-agnostic stacks.
3476
+
3477
+ :default: false
3478
+ '''
3479
+ result = self._values.get("cached_in_context")
3480
+ return typing.cast(typing.Optional[builtins.bool], result)
3481
+
3482
+ @builtins.property
3483
+ def user_data(self) -> typing.Optional["UserData"]:
3484
+ '''Initial user data.
3485
+
3486
+ :default: - Empty UserData for Linux machines
3487
+ '''
3488
+ result = self._values.get("user_data")
3489
+ return typing.cast(typing.Optional["UserData"], result)
3490
+
3491
+ @builtins.property
3492
+ def parameter_name(self) -> builtins.str:
3493
+ '''The name of the SSM parameter that contains the AMI value.'''
3494
+ result = self._values.get("parameter_name")
3495
+ assert result is not None, "Required property 'parameter_name' is missing"
3496
+ return typing.cast(builtins.str, result)
3497
+
3498
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
3499
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
3500
+
3501
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
3502
+ return not (rhs == self)
3503
+
3504
+ def __repr__(self) -> str:
3505
+ return "AmazonLinuxImageSsmParameterBaseProps(%s)" % ", ".join(
3506
+ k + "=" + repr(v) for k, v in self._values.items()
3507
+ )
3508
+
3509
+
3510
+ @jsii.data_type(
3511
+ jsii_type="aws-cdk-lib.aws_ec2.AmazonLinuxImageSsmParameterCommonOptions",
3512
+ jsii_struct_bases=[AmazonLinuxImageSsmParameterBaseOptions],
3513
+ name_mapping={
3514
+ "cached_in_context": "cachedInContext",
3515
+ "user_data": "userData",
3516
+ "cpu_type": "cpuType",
3517
+ "edition": "edition",
3518
+ },
3519
+ )
3520
+ class AmazonLinuxImageSsmParameterCommonOptions(
3521
+ AmazonLinuxImageSsmParameterBaseOptions,
3522
+ ):
3523
+ def __init__(
3524
+ self,
3525
+ *,
3526
+ cached_in_context: typing.Optional[builtins.bool] = None,
3527
+ user_data: typing.Optional["UserData"] = None,
3528
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
3529
+ edition: typing.Optional[AmazonLinuxEdition] = None,
3530
+ ) -> None:
3531
+ '''Common options across all generations.
3532
+
3533
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
3534
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
3535
+ :param cpu_type: CPU Type. Default: AmazonLinuxCpuType.X86_64
3536
+ :param edition: What edition of Amazon Linux to use. Default: AmazonLinuxEdition.Standard
3537
+
3538
+ :exampleMetadata: fixture=_generated
3539
+
3540
+ Example::
3541
+
3542
+ # The code below shows an example of how to instantiate this type.
3543
+ # The values are placeholders you should change.
3544
+ from aws_cdk import aws_ec2 as ec2
3545
+
3546
+ # user_data: ec2.UserData
3547
+
3548
+ amazon_linux_image_ssm_parameter_common_options = ec2.AmazonLinuxImageSsmParameterCommonOptions(
3549
+ cached_in_context=False,
3550
+ cpu_type=ec2.AmazonLinuxCpuType.ARM_64,
3551
+ edition=ec2.AmazonLinuxEdition.STANDARD,
3552
+ user_data=user_data
3553
+ )
3554
+ '''
3555
+ if __debug__:
3556
+ type_hints = typing.get_type_hints(_typecheckingstub__8fcdd01a6ab45c77447fba339b5a9358c3ab40c4833c1f86c68009a6a3bb1422)
3557
+ check_type(argname="argument cached_in_context", value=cached_in_context, expected_type=type_hints["cached_in_context"])
3558
+ check_type(argname="argument user_data", value=user_data, expected_type=type_hints["user_data"])
3559
+ check_type(argname="argument cpu_type", value=cpu_type, expected_type=type_hints["cpu_type"])
3560
+ check_type(argname="argument edition", value=edition, expected_type=type_hints["edition"])
3561
+ self._values: typing.Dict[builtins.str, typing.Any] = {}
3562
+ if cached_in_context is not None:
3563
+ self._values["cached_in_context"] = cached_in_context
3564
+ if user_data is not None:
3565
+ self._values["user_data"] = user_data
3566
+ if cpu_type is not None:
3567
+ self._values["cpu_type"] = cpu_type
3568
+ if edition is not None:
3569
+ self._values["edition"] = edition
3570
+
3571
+ @builtins.property
3572
+ def cached_in_context(self) -> typing.Optional[builtins.bool]:
3573
+ '''Whether the AMI ID is cached to be stable between deployments.
3574
+
3575
+ By default, the newest image is used on each deployment. This will cause
3576
+ instances to be replaced whenever a new version is released, and may cause
3577
+ downtime if there aren't enough running instances in the AutoScalingGroup
3578
+ to reschedule the tasks on.
3579
+
3580
+ If set to true, the AMI ID will be cached in ``cdk.context.json`` and the
3581
+ same value will be used on future runs. Your instances will not be replaced
3582
+ but your AMI version will grow old over time. To refresh the AMI lookup,
3583
+ you will have to evict the value from the cache using the ``cdk context``
3584
+ command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
3585
+ more information.
3586
+
3587
+ Can not be set to ``true`` in environment-agnostic stacks.
3588
+
3589
+ :default: false
3590
+ '''
3591
+ result = self._values.get("cached_in_context")
3592
+ return typing.cast(typing.Optional[builtins.bool], result)
3593
+
3594
+ @builtins.property
3595
+ def user_data(self) -> typing.Optional["UserData"]:
3596
+ '''Initial user data.
3597
+
3598
+ :default: - Empty UserData for Linux machines
3599
+ '''
3600
+ result = self._values.get("user_data")
3601
+ return typing.cast(typing.Optional["UserData"], result)
3602
+
3603
+ @builtins.property
3604
+ def cpu_type(self) -> typing.Optional[AmazonLinuxCpuType]:
3605
+ '''CPU Type.
3606
+
3607
+ :default: AmazonLinuxCpuType.X86_64
3033
3608
  '''
3034
3609
  result = self._values.get("cpu_type")
3035
3610
  return typing.cast(typing.Optional[AmazonLinuxCpuType], result)
@@ -3038,56 +3613,11 @@ class AmazonLinuxImageProps:
3038
3613
  def edition(self) -> typing.Optional[AmazonLinuxEdition]:
3039
3614
  '''What edition of Amazon Linux to use.
3040
3615
 
3041
- :default: Standard
3616
+ :default: AmazonLinuxEdition.Standard
3042
3617
  '''
3043
3618
  result = self._values.get("edition")
3044
3619
  return typing.cast(typing.Optional[AmazonLinuxEdition], result)
3045
3620
 
3046
- @builtins.property
3047
- def generation(self) -> typing.Optional[AmazonLinuxGeneration]:
3048
- '''What generation of Amazon Linux to use.
3049
-
3050
- :default: AmazonLinux
3051
- '''
3052
- result = self._values.get("generation")
3053
- return typing.cast(typing.Optional[AmazonLinuxGeneration], result)
3054
-
3055
- @builtins.property
3056
- def kernel(self) -> typing.Optional["AmazonLinuxKernel"]:
3057
- '''What kernel version of Amazon Linux to use.
3058
-
3059
- :default: -
3060
- '''
3061
- result = self._values.get("kernel")
3062
- return typing.cast(typing.Optional["AmazonLinuxKernel"], result)
3063
-
3064
- @builtins.property
3065
- def storage(self) -> typing.Optional["AmazonLinuxStorage"]:
3066
- '''What storage backed image to use.
3067
-
3068
- :default: GeneralPurpose
3069
- '''
3070
- result = self._values.get("storage")
3071
- return typing.cast(typing.Optional["AmazonLinuxStorage"], result)
3072
-
3073
- @builtins.property
3074
- def user_data(self) -> typing.Optional["UserData"]:
3075
- '''Initial user data.
3076
-
3077
- :default: - Empty UserData for Linux machines
3078
- '''
3079
- result = self._values.get("user_data")
3080
- return typing.cast(typing.Optional["UserData"], result)
3081
-
3082
- @builtins.property
3083
- def virtualization(self) -> typing.Optional["AmazonLinuxVirt"]:
3084
- '''Virtualization type.
3085
-
3086
- :default: HVM
3087
- '''
3088
- result = self._values.get("virtualization")
3089
- return typing.cast(typing.Optional["AmazonLinuxVirt"], result)
3090
-
3091
3621
  def __eq__(self, rhs: typing.Any) -> builtins.bool:
3092
3622
  return isinstance(rhs, self.__class__) and rhs._values == self._values
3093
3623
 
@@ -3095,69 +3625,14 @@ class AmazonLinuxImageProps:
3095
3625
  return not (rhs == self)
3096
3626
 
3097
3627
  def __repr__(self) -> str:
3098
- return "AmazonLinuxImageProps(%s)" % ", ".join(
3628
+ return "AmazonLinuxImageSsmParameterCommonOptions(%s)" % ", ".join(
3099
3629
  k + "=" + repr(v) for k, v in self._values.items()
3100
3630
  )
3101
3631
 
3102
3632
 
3103
3633
  @jsii.enum(jsii_type="aws-cdk-lib.aws_ec2.AmazonLinuxKernel")
3104
3634
  class AmazonLinuxKernel(enum.Enum):
3105
- '''Amazon Linux Kernel.
3106
-
3107
- :exampleMetadata: infused
3108
-
3109
- Example::
3110
-
3111
- # Example automatically generated from non-compiling source. May contain errors.
3112
- # vpc: ec2.Vpc
3113
- # instance_type: ec2.InstanceType
3114
-
3115
-
3116
- # Amazon Linux 1
3117
- ec2.Instance(self, "Instance1",
3118
- vpc=vpc,
3119
- instance_type=instance_type,
3120
- machine_image=ec2.MachineImage.latest_amazon_linux()
3121
- )
3122
-
3123
- # Amazon Linux 2
3124
- ec2.Instance(self, "Instance2",
3125
- vpc=vpc,
3126
- instance_type=instance_type,
3127
- machine_image=ec2.MachineImage.latest_amazon_linux(
3128
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2
3129
- )
3130
- )
3131
-
3132
- # Amazon Linux 2 with kernel 5.x
3133
- ec2.Instance(self, "Instance3",
3134
- vpc=vpc,
3135
- instance_type=instance_type,
3136
- machine_image=ec2.MachineImage.latest_amazon_linux(
3137
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
3138
- kernel=ec2.AmazonLinuxKernel.KERNEL5_X
3139
- )
3140
- )
3141
-
3142
- # AWS Linux 2022
3143
- ec2.Instance(self, "Instance4",
3144
- vpc=vpc,
3145
- instance_type=instance_type,
3146
- machine_image=ec2.MachineImage.latest_amazon_linux(
3147
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2022
3148
- )
3149
- )
3150
-
3151
- # Graviton 3 Processor
3152
- ec2.Instance(self, "Instance5",
3153
- vpc=vpc,
3154
- instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
3155
- machine_image=ec2.MachineImage.latest_amazon_linux(
3156
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
3157
- cpu_type=ec2.AmazonLinuxCpuType.ARM_64
3158
- )
3159
- )
3160
- '''
3635
+ '''Amazon Linux Kernel.'''
3161
3636
 
3162
3637
  KERNEL5_X = "KERNEL5_X"
3163
3638
  '''Standard edition.'''
@@ -3165,7 +3640,8 @@ class AmazonLinuxKernel(enum.Enum):
3165
3640
 
3166
3641
  @jsii.enum(jsii_type="aws-cdk-lib.aws_ec2.AmazonLinuxStorage")
3167
3642
  class AmazonLinuxStorage(enum.Enum):
3168
- '''
3643
+ '''Available storage options for Amazon Linux images Only applies to Amazon Linux & Amazon Linux 2.
3644
+
3169
3645
  :exampleMetadata: lit=aws-autoscaling/test/example.images.lit.ts infused
3170
3646
 
3171
3647
  Example::
@@ -3273,7 +3749,6 @@ class ApplyCloudFormationInitOptions:
3273
3749
 
3274
3750
  Example::
3275
3751
 
3276
- # Example automatically generated from non-compiling source. May contain errors.
3277
3752
  # vpc: ec2.Vpc
3278
3753
  # instance_type: ec2.InstanceType
3279
3754
  # machine_image: ec2.IMachineImage
@@ -3713,14 +4188,13 @@ class AwsIpamProps:
3713
4188
 
3714
4189
  Example::
3715
4190
 
3716
- # Example automatically generated from non-compiling source. May contain errors.
3717
4191
  from aws_cdk.aws_ec2 import IpAddresses
3718
4192
 
3719
4193
  # pool: ec2.CfnIPAMPool
3720
4194
 
3721
4195
 
3722
- ec2.Vpc(stack, "TheVPC",
3723
- ip_addresses=ec2.IpAddresses.aws_ipam_allocation(
4196
+ ec2.Vpc(self, "TheVPC",
4197
+ ip_addresses=IpAddresses.aws_ipam_allocation(
3724
4198
  ipv4_ipam_pool_id=pool.ref,
3725
4199
  ipv4_netmask_length=18,
3726
4200
  default_subnet_ipv4_netmask_length=24
@@ -4111,7 +4585,6 @@ class BlockDeviceVolume(
4111
4585
 
4112
4586
  Example::
4113
4587
 
4114
- # Example automatically generated from non-compiling source. May contain errors.
4115
4588
  # vpc: ec2.Vpc
4116
4589
  # instance_type: ec2.InstanceType
4117
4590
  # machine_image: ec2.IMachineImage
@@ -18345,7 +18818,7 @@ class CfnInstance(
18345
18818
  :param private_ip_address: The primary IPv4 address. You must specify a value from the IPv4 address range of the subnet. Only one private IP address can be designated as primary. You can't specify this option if you've specified the option to designate a private IP address as the primary IP address in a network interface specification. You cannot specify this option if you're launching more than one instance in the request. You cannot specify this option and the network interfaces option in the same request. If you make an update to an instance that requires replacement, you must assign a new private IP address. During a replacement, AWS CloudFormation creates a new instance but doesn't delete the old instance until the stack has successfully updated. If the stack update fails, AWS CloudFormation uses the old instance to roll back the stack to the previous working state. The old and new instances cannot have the same private IP address.
18346
18819
  :param propagate_tags_to_volume_on_creation: Indicates whether to assign the tags from the instance to all of the volumes attached to the instance at launch. If you specify ``true`` and you assign tags to the instance, those tags are automatically assigned to all of the volumes that you attach to the instance at launch. If you specify ``false`` , those tags are not assigned to the attached volumes.
18347
18820
  :param ramdisk_id: The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the kernel requirements for information about whether you need to specify a RAM disk. To find kernel requirements, go to the AWS Resource Center and search for the kernel ID. .. epigraph:: We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see `PV-GRUB <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html>`_ in the *Amazon EC2 User Guide* .
18348
- :param security_group_ids: The IDs of the security groups. You can create a security group using `CreateSecurityGroup <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html>`_ . If you specify a network interface, you must specify any security groups as part of the network interface.
18821
+ :param security_group_ids: The IDs of the security groups. You can specify the IDs of existing security groups and references to resources created by the stack template. If you specify a network interface, you must specify any security groups as part of the network interface.
18349
18822
  :param security_groups: [Default VPC] The names of the security groups. For a nondefault VPC, you must use security group IDs instead. You cannot specify this option and the network interfaces option in the same request. The list can contain both the name of existing Amazon EC2 security groups or references to AWS::EC2::SecurityGroup resources created in the template. Default: Amazon EC2 uses the default security group.
18350
18823
  :param source_dest_check: Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives. If the value is ``true`` , source/destination checks are enabled; otherwise, they are disabled. The default value is ``true`` . You must disable source/destination checks if the instance runs services such as network address translation, routing, or firewalls.
18351
18824
  :param ssm_associations: The SSM `document <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html>`_ and parameter values in AWS Systems Manager to associate with this instance. To use this property, you must specify an IAM instance profile role for the instance. For more information, see `Create an IAM instance profile for Systems Manager <https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-configuring-access-role.html>`_ in the *AWS Systems Manager User Guide* . .. epigraph:: You can currently associate only one document with an instance.
@@ -19180,7 +19653,9 @@ class CfnInstance(
19180
19653
  @builtins.property
19181
19654
  @jsii.member(jsii_name="securityGroupIds")
19182
19655
  def security_group_ids(self) -> typing.Optional[typing.List[builtins.str]]:
19183
- '''The IDs of the security groups. You can create a security group using `CreateSecurityGroup <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html>`_ .
19656
+ '''The IDs of the security groups.
19657
+
19658
+ You can specify the IDs of existing security groups and references to resources created by the stack template.
19184
19659
 
19185
19660
  If you specify a network interface, you must specify any security groups as part of the network interface.
19186
19661
 
@@ -21184,7 +21659,7 @@ class CfnInstanceProps:
21184
21659
  :param private_ip_address: The primary IPv4 address. You must specify a value from the IPv4 address range of the subnet. Only one private IP address can be designated as primary. You can't specify this option if you've specified the option to designate a private IP address as the primary IP address in a network interface specification. You cannot specify this option if you're launching more than one instance in the request. You cannot specify this option and the network interfaces option in the same request. If you make an update to an instance that requires replacement, you must assign a new private IP address. During a replacement, AWS CloudFormation creates a new instance but doesn't delete the old instance until the stack has successfully updated. If the stack update fails, AWS CloudFormation uses the old instance to roll back the stack to the previous working state. The old and new instances cannot have the same private IP address.
21185
21660
  :param propagate_tags_to_volume_on_creation: Indicates whether to assign the tags from the instance to all of the volumes attached to the instance at launch. If you specify ``true`` and you assign tags to the instance, those tags are automatically assigned to all of the volumes that you attach to the instance at launch. If you specify ``false`` , those tags are not assigned to the attached volumes.
21186
21661
  :param ramdisk_id: The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the kernel requirements for information about whether you need to specify a RAM disk. To find kernel requirements, go to the AWS Resource Center and search for the kernel ID. .. epigraph:: We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see `PV-GRUB <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html>`_ in the *Amazon EC2 User Guide* .
21187
- :param security_group_ids: The IDs of the security groups. You can create a security group using `CreateSecurityGroup <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html>`_ . If you specify a network interface, you must specify any security groups as part of the network interface.
21662
+ :param security_group_ids: The IDs of the security groups. You can specify the IDs of existing security groups and references to resources created by the stack template. If you specify a network interface, you must specify any security groups as part of the network interface.
21188
21663
  :param security_groups: [Default VPC] The names of the security groups. For a nondefault VPC, you must use security group IDs instead. You cannot specify this option and the network interfaces option in the same request. The list can contain both the name of existing Amazon EC2 security groups or references to AWS::EC2::SecurityGroup resources created in the template. Default: Amazon EC2 uses the default security group.
21189
21664
  :param source_dest_check: Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives. If the value is ``true`` , source/destination checks are enabled; otherwise, they are disabled. The default value is ``true`` . You must disable source/destination checks if the instance runs services such as network address translation, routing, or firewalls.
21190
21665
  :param ssm_associations: The SSM `document <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html>`_ and parameter values in AWS Systems Manager to associate with this instance. To use this property, you must specify an IAM instance profile role for the instance. For more information, see `Create an IAM instance profile for Systems Manager <https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-configuring-access-role.html>`_ in the *AWS Systems Manager User Guide* . .. epigraph:: You can currently associate only one document with an instance.
@@ -21856,7 +22331,9 @@ class CfnInstanceProps:
21856
22331
 
21857
22332
  @builtins.property
21858
22333
  def security_group_ids(self) -> typing.Optional[typing.List[builtins.str]]:
21859
- '''The IDs of the security groups. You can create a security group using `CreateSecurityGroup <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html>`_ .
22334
+ '''The IDs of the security groups.
22335
+
22336
+ You can specify the IDs of existing security groups and references to resources created by the stack template.
21860
22337
 
21861
22338
  If you specify a network interface, you must specify any security groups as part of the network interface.
21862
22339
 
@@ -24746,7 +25223,7 @@ class CfnLaunchTemplate(
24746
25223
  :param placement: The placement for the instance.
24747
25224
  :param private_dns_name_options: The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries should be handled. For more information, see `Amazon EC2 instance hostname types <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-naming.html>`_ in the *Amazon Elastic Compute Cloud User Guide* .
24748
25225
  :param ram_disk_id: The ID of the RAM disk. .. epigraph:: We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see `User provided kernels <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html>`_ in the *Amazon Elastic Compute Cloud User Guide* .
24749
- :param security_group_ids: One or more security group IDs. You can create a security group using `CreateSecurityGroup <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html>`_ . You cannot specify both a security group ID and security name in the same request.
25226
+ :param security_group_ids: The IDs of the security groups. You can specify the IDs of existing security groups and references to resources created by the stack template.
24750
25227
  :param security_groups: One or more security group names. For a nondefault VPC, you must use security group IDs instead. You cannot specify both a security group ID and security name in the same request.
24751
25228
  :param tag_specifications: The tags to apply to the resources that are created during instance launch. You can specify tags for the following resources only: - Instances - Volumes - Elastic graphics - Spot Instance requests - Network interfaces To tag a resource after it has been created, see `CreateTags <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html>`_ . .. epigraph:: To tag the launch template itself, you must use the `TagSpecification <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateLaunchTemplate.html>`_ parameter.
24752
25229
  :param user_data: The user data to make available to the instance. You must provide base64-encoded text. User data is limited to 16 KB. For more information, see `Run commands on your Linux instance at launch <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html>`_ (Linux) or `Work with instance user data <https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/instancedata-add-user-data.html>`_ (Windows) in the *Amazon Elastic Compute Cloud User Guide* . If you are creating the launch template for use with AWS Batch , the user data must be provided in the `MIME multi-part archive format <https://docs.aws.amazon.com/https://cloudinit.readthedocs.io/en/latest/topics/format.html#mime-multi-part-archive>`_ . For more information, see `Amazon EC2 user data in launch templates <https://docs.aws.amazon.com/batch/latest/userguide/launch-templates.html>`_ in the *AWS Batch User Guide* .
@@ -25389,9 +25866,9 @@ class CfnLaunchTemplate(
25389
25866
 
25390
25867
  @builtins.property
25391
25868
  def security_group_ids(self) -> typing.Optional[typing.List[builtins.str]]:
25392
- '''One or more security group IDs.
25869
+ '''The IDs of the security groups.
25393
25870
 
25394
- You can create a security group using `CreateSecurityGroup <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html>`_ . You cannot specify both a security group ID and security name in the same request.
25871
+ You can specify the IDs of existing security groups and references to resources created by the stack template.
25395
25872
 
25396
25873
  :link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-securitygroupids
25397
25874
  '''
@@ -57009,7 +57486,7 @@ class CfnVolume(
57009
57486
 
57010
57487
  :param scope: - scope in which this resource is defined.
57011
57488
  :param id: - scoped id of the resource.
57012
- :param availability_zone: The Availability Zone in which to create the volume.
57489
+ :param availability_zone: The ID of the Availability Zone in which to create the volume. For example, ``us-east-1a`` .
57013
57490
  :param auto_enable_io: Indicates whether the volume is auto-enabled for I/O operations. By default, Amazon EBS disables I/O to the volume from attached EC2 instances when it determines that a volume's data is potentially inconsistent. If the consistency of the volume is not a concern, and you prefer that the volume be made available immediately if it's impaired, you can configure the volume to automatically enable I/O.
57014
57491
  :param encrypted: Indicates whether the volume should be encrypted. The effect of setting the encryption state to ``true`` depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see `Encryption by default <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-by-default>`_ in the *Amazon Elastic Compute Cloud User Guide* . Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see `Supported instance types <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances>`_ .
57015
57492
  :param iops: The number of I/O operations per second (IOPS). For ``gp3`` , ``io1`` , and ``io2`` volumes, this represents the number of IOPS that are provisioned for the volume. For ``gp2`` volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. The following are the supported values for each volume type: - ``gp3`` : 3,000-16,000 IOPS - ``io1`` : 100-64,000 IOPS - ``io2`` : 100-64,000 IOPS ``io1`` and ``io2`` volumes support up to 64,000 IOPS only on `Instances built on the Nitro System <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances>`_ . Other instance families support performance up to 32,000 IOPS. This parameter is required for ``io1`` and ``io2`` volumes. The default for ``gp3`` volumes is 3,000 IOPS. This parameter is not supported for ``gp2`` , ``st1`` , ``sc1`` , or ``standard`` volumes.
@@ -57099,7 +57576,9 @@ class CfnVolume(
57099
57576
  @builtins.property
57100
57577
  @jsii.member(jsii_name="availabilityZone")
57101
57578
  def availability_zone(self) -> builtins.str:
57102
- '''The Availability Zone in which to create the volume.
57579
+ '''The ID of the Availability Zone in which to create the volume.
57580
+
57581
+ For example, ``us-east-1a`` .
57103
57582
 
57104
57583
  :link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html#cfn-ec2-volume-availabilityzone
57105
57584
  '''
@@ -57624,7 +58103,7 @@ class CfnVolumeProps:
57624
58103
  ) -> None:
57625
58104
  '''Properties for defining a ``CfnVolume``.
57626
58105
 
57627
- :param availability_zone: The Availability Zone in which to create the volume.
58106
+ :param availability_zone: The ID of the Availability Zone in which to create the volume. For example, ``us-east-1a`` .
57628
58107
  :param auto_enable_io: Indicates whether the volume is auto-enabled for I/O operations. By default, Amazon EBS disables I/O to the volume from attached EC2 instances when it determines that a volume's data is potentially inconsistent. If the consistency of the volume is not a concern, and you prefer that the volume be made available immediately if it's impaired, you can configure the volume to automatically enable I/O.
57629
58108
  :param encrypted: Indicates whether the volume should be encrypted. The effect of setting the encryption state to ``true`` depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see `Encryption by default <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-by-default>`_ in the *Amazon Elastic Compute Cloud User Guide* . Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see `Supported instance types <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances>`_ .
57630
58109
  :param iops: The number of I/O operations per second (IOPS). For ``gp3`` , ``io1`` , and ``io2`` volumes, this represents the number of IOPS that are provisioned for the volume. For ``gp2`` volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. The following are the supported values for each volume type: - ``gp3`` : 3,000-16,000 IOPS - ``io1`` : 100-64,000 IOPS - ``io2`` : 100-64,000 IOPS ``io1`` and ``io2`` volumes support up to 64,000 IOPS only on `Instances built on the Nitro System <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances>`_ . Other instance families support performance up to 32,000 IOPS. This parameter is required for ``io1`` and ``io2`` volumes. The default for ``gp3`` volumes is 3,000 IOPS. This parameter is not supported for ``gp2`` , ``st1`` , ``sc1`` , or ``standard`` volumes.
@@ -57708,7 +58187,9 @@ class CfnVolumeProps:
57708
58187
 
57709
58188
  @builtins.property
57710
58189
  def availability_zone(self) -> builtins.str:
57711
- '''The Availability Zone in which to create the volume.
58190
+ '''The ID of the Availability Zone in which to create the volume.
58191
+
58192
+ For example, ``us-east-1a`` .
57712
58193
 
57713
58194
  :link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html#cfn-ec2-volume-availabilityzone
57714
58195
  '''
@@ -59396,7 +59877,6 @@ class CloudFormationInit(
59396
59877
 
59397
59878
  Example::
59398
59879
 
59399
- # Example automatically generated from non-compiling source. May contain errors.
59400
59880
  # vpc: ec2.Vpc
59401
59881
  # instance_type: ec2.InstanceType
59402
59882
 
@@ -59404,12 +59884,9 @@ class CloudFormationInit(
59404
59884
  ec2.Instance(self, "Instance",
59405
59885
  vpc=vpc,
59406
59886
  instance_type=instance_type,
59407
- machine_image=ec2.MachineImage.latest_amazon_linux(
59408
- # Amazon Linux 2 uses SystemD
59409
- generation=ec2.AmazonLinuxGeneration, AMAZON_LINUX_2=AMAZON_LINUX_2
59410
- ),
59887
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(),
59411
59888
 
59412
- init=ec2.CloudFormationInit.from_elements([
59889
+ init=ec2.CloudFormationInit.from_elements(
59413
59890
  # Create a simple config file that runs a Python web server
59414
59891
  ec2.InitService.systemd_config_file("simpleserver",
59415
59892
  command="/usr/bin/python3 -m http.server 8080",
@@ -59420,8 +59897,7 @@ class CloudFormationInit(
59420
59897
  service_manager=ec2.ServiceManager.SYSTEMD
59421
59898
  ),
59422
59899
  # Drop an example file to show the web server working
59423
- ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!")
59424
- ])
59900
+ ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!"))
59425
59901
  )
59426
59902
  '''
59427
59903
 
@@ -59727,7 +60203,6 @@ class ConfigSetProps:
59727
60203
 
59728
60204
  Example::
59729
60205
 
59730
- # Example automatically generated from non-compiling source. May contain errors.
59731
60206
  # vpc: ec2.Vpc
59732
60207
  # instance_type: ec2.InstanceType
59733
60208
  # machine_image: ec2.IMachineImage
@@ -60422,7 +60897,6 @@ class ExecuteFileOptions:
60422
60897
 
60423
60898
  Example::
60424
60899
 
60425
- # Example automatically generated from non-compiling source. May contain errors.
60426
60900
  from aws_cdk.aws_s3_assets import Asset
60427
60901
 
60428
60902
  # instance: ec2.Instance
@@ -60491,7 +60965,6 @@ class FlowLogDestination(
60491
60965
 
60492
60966
  Example::
60493
60967
 
60494
- # Example automatically generated from non-compiling source. May contain errors.
60495
60968
  # vpc: ec2.Vpc
60496
60969
 
60497
60970
 
@@ -60780,7 +61253,6 @@ class FlowLogMaxAggregationInterval(enum.Enum):
60780
61253
 
60781
61254
  Example::
60782
61255
 
60783
- # Example automatically generated from non-compiling source. May contain errors.
60784
61256
  vpc = ec2.Vpc(self, "Vpc")
60785
61257
 
60786
61258
  vpc.add_flow_log("FlowLogS3",
@@ -60790,7 +61262,7 @@ class FlowLogMaxAggregationInterval(enum.Enum):
60790
61262
  # Only reject traffic and interval every minute.
60791
61263
  vpc.add_flow_log("FlowLogCloudWatch",
60792
61264
  traffic_type=ec2.FlowLogTrafficType.REJECT,
60793
- max_aggregation_interval=FlowLogMaxAggregationInterval.ONE_MINUTE
61265
+ max_aggregation_interval=ec2.FlowLogMaxAggregationInterval.ONE_MINUTE
60794
61266
  )
60795
61267
  '''
60796
61268
 
@@ -60830,7 +61302,6 @@ class FlowLogOptions:
60830
61302
 
60831
61303
  Example::
60832
61304
 
60833
- # Example automatically generated from non-compiling source. May contain errors.
60834
61305
  vpc = ec2.Vpc(self, "Vpc")
60835
61306
 
60836
61307
  vpc.add_flow_log("FlowLogS3",
@@ -60840,7 +61311,7 @@ class FlowLogOptions:
60840
61311
  # Only reject traffic and interval every minute.
60841
61312
  vpc.add_flow_log("FlowLogCloudWatch",
60842
61313
  traffic_type=ec2.FlowLogTrafficType.REJECT,
60843
- max_aggregation_interval=FlowLogMaxAggregationInterval.ONE_MINUTE
61314
+ max_aggregation_interval=ec2.FlowLogMaxAggregationInterval.ONE_MINUTE
60844
61315
  )
60845
61316
  '''
60846
61317
  if __debug__:
@@ -60954,7 +61425,6 @@ class FlowLogProps(FlowLogOptions):
60954
61425
 
60955
61426
  Example::
60956
61427
 
60957
- # Example automatically generated from non-compiling source. May contain errors.
60958
61428
  # vpc: ec2.Vpc
60959
61429
 
60960
61430
 
@@ -61081,7 +61551,6 @@ class FlowLogResourceType(
61081
61551
 
61082
61552
  Example::
61083
61553
 
61084
- # Example automatically generated from non-compiling source. May contain errors.
61085
61554
  # vpc: ec2.Vpc
61086
61555
 
61087
61556
 
@@ -61200,7 +61669,6 @@ class FlowLogTrafficType(enum.Enum):
61200
61669
 
61201
61670
  Example::
61202
61671
 
61203
- # Example automatically generated from non-compiling source. May contain errors.
61204
61672
  vpc = ec2.Vpc(self, "Vpc")
61205
61673
 
61206
61674
  vpc.add_flow_log("FlowLogS3",
@@ -61210,7 +61678,7 @@ class FlowLogTrafficType(enum.Enum):
61210
61678
  # Only reject traffic and interval every minute.
61211
61679
  vpc.add_flow_log("FlowLogCloudWatch",
61212
61680
  traffic_type=ec2.FlowLogTrafficType.REJECT,
61213
- max_aggregation_interval=FlowLogMaxAggregationInterval.ONE_MINUTE
61681
+ max_aggregation_interval=ec2.FlowLogMaxAggregationInterval.ONE_MINUTE
61214
61682
  )
61215
61683
  '''
61216
61684
 
@@ -61357,7 +61825,6 @@ class GatewayVpcEndpointOptions:
61357
61825
 
61358
61826
  Example::
61359
61827
 
61360
- # Example automatically generated from non-compiling source. May contain errors.
61361
61828
  # vpc: ec2.Vpc
61362
61829
 
61363
61830
 
@@ -61460,7 +61927,6 @@ class GatewayVpcEndpointProps(GatewayVpcEndpointOptions):
61460
61927
 
61461
61928
  Example::
61462
61929
 
61463
- # Example automatically generated from non-compiling source. May contain errors.
61464
61930
  # vpc: ec2.Vpc
61465
61931
 
61466
61932
 
@@ -64010,7 +64476,6 @@ class InitCommandOptions:
64010
64476
 
64011
64477
  Example::
64012
64478
 
64013
- # Example automatically generated from non-compiling source. May contain errors.
64014
64479
  handle = ec2.InitServiceRestartHandle()
64015
64480
  ec2.CloudFormationInit.from_elements(
64016
64481
  ec2.InitCommand.shell_command("/usr/bin/custom-nginx-install.sh", service_restart_handles=[handle]),
@@ -64188,7 +64653,6 @@ class InitConfig(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_ec2.InitCon
64188
64653
 
64189
64654
  Example::
64190
64655
 
64191
- # Example automatically generated from non-compiling source. May contain errors.
64192
64656
  # vpc: ec2.Vpc
64193
64657
  # instance_type: ec2.InstanceType
64194
64658
  # machine_image: ec2.IMachineImage
@@ -64280,7 +64744,6 @@ class InitElement(
64280
64744
 
64281
64745
  Example::
64282
64746
 
64283
- # Example automatically generated from non-compiling source. May contain errors.
64284
64747
  # my_bucket: s3.Bucket
64285
64748
 
64286
64749
 
@@ -64327,7 +64790,6 @@ class InitFile(
64327
64790
 
64328
64791
  Example::
64329
64792
 
64330
- # Example automatically generated from non-compiling source. May contain errors.
64331
64793
  # vpc: ec2.Vpc
64332
64794
  # instance_type: ec2.InstanceType
64333
64795
 
@@ -64335,12 +64797,9 @@ class InitFile(
64335
64797
  ec2.Instance(self, "Instance",
64336
64798
  vpc=vpc,
64337
64799
  instance_type=instance_type,
64338
- machine_image=ec2.MachineImage.latest_amazon_linux(
64339
- # Amazon Linux 2 uses SystemD
64340
- generation=ec2.AmazonLinuxGeneration, AMAZON_LINUX_2=AMAZON_LINUX_2
64341
- ),
64800
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(),
64342
64801
 
64343
- init=ec2.CloudFormationInit.from_elements([
64802
+ init=ec2.CloudFormationInit.from_elements(
64344
64803
  # Create a simple config file that runs a Python web server
64345
64804
  ec2.InitService.systemd_config_file("simpleserver",
64346
64805
  command="/usr/bin/python3 -m http.server 8080",
@@ -64351,8 +64810,7 @@ class InitFile(
64351
64810
  service_manager=ec2.ServiceManager.SYSTEMD
64352
64811
  ),
64353
64812
  # Drop an example file to show the web server working
64354
- ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!")
64355
- ])
64813
+ ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!"))
64356
64814
  )
64357
64815
  '''
64358
64816
 
@@ -64766,7 +65224,6 @@ class InitFileOptions:
64766
65224
 
64767
65225
  Example::
64768
65226
 
64769
- # Example automatically generated from non-compiling source. May contain errors.
64770
65227
  # my_bucket: s3.Bucket
64771
65228
 
64772
65229
 
@@ -64883,7 +65340,6 @@ class InitGroup(
64883
65340
 
64884
65341
  Example::
64885
65342
 
64886
- # Example automatically generated from non-compiling source. May contain errors.
64887
65343
  # vpc: ec2.Vpc
64888
65344
  # instance_type: ec2.InstanceType
64889
65345
  # machine_image: ec2.IMachineImage
@@ -64990,7 +65446,6 @@ class InitPackage(
64990
65446
 
64991
65447
  Example::
64992
65448
 
64993
- # Example automatically generated from non-compiling source. May contain errors.
64994
65449
  # vpc: ec2.Vpc
64995
65450
  # instance_type: ec2.InstanceType
64996
65451
  # machine_image: ec2.IMachineImage
@@ -65233,7 +65688,6 @@ class InitService(
65233
65688
 
65234
65689
  Example::
65235
65690
 
65236
- # Example automatically generated from non-compiling source. May contain errors.
65237
65691
  # my_bucket: s3.Bucket
65238
65692
 
65239
65693
 
@@ -65375,7 +65829,6 @@ class InitServiceOptions:
65375
65829
 
65376
65830
  Example::
65377
65831
 
65378
- # Example automatically generated from non-compiling source. May contain errors.
65379
65832
  # my_bucket: s3.Bucket
65380
65833
 
65381
65834
 
@@ -65483,7 +65936,6 @@ class InitServiceRestartHandle(
65483
65936
  For example, the following will run a custom command to install Nginx,
65484
65937
  and trigger the nginx service to be restarted after the command has run::
65485
65938
 
65486
- # Example automatically generated from non-compiling source. May contain errors.
65487
65939
  handle = ec2.InitServiceRestartHandle()
65488
65940
  ec2.CloudFormationInit.from_elements(
65489
65941
  ec2.InitCommand.shell_command("/usr/bin/custom-nginx-install.sh", service_restart_handles=[handle]),
@@ -65493,7 +65945,6 @@ class InitServiceRestartHandle(
65493
65945
 
65494
65946
  Example::
65495
65947
 
65496
- # Example automatically generated from non-compiling source. May contain errors.
65497
65948
  # my_bucket: s3.Bucket
65498
65949
 
65499
65950
 
@@ -65522,7 +65973,6 @@ class InitSource(
65522
65973
 
65523
65974
  Example::
65524
65975
 
65525
- # Example automatically generated from non-compiling source. May contain errors.
65526
65976
  # my_bucket: s3.Bucket
65527
65977
 
65528
65978
 
@@ -65734,7 +66184,6 @@ class InitSourceOptions:
65734
66184
 
65735
66185
  Example::
65736
66186
 
65737
- # Example automatically generated from non-compiling source. May contain errors.
65738
66187
  # my_bucket: s3.Bucket
65739
66188
 
65740
66189
 
@@ -65793,7 +66242,6 @@ class InitUser(
65793
66242
 
65794
66243
  Example::
65795
66244
 
65796
- # Example automatically generated from non-compiling source. May contain errors.
65797
66245
  # vpc: ec2.Vpc
65798
66246
  # instance_type: ec2.InstanceType
65799
66247
  # machine_image: ec2.IMachineImage
@@ -66006,7 +66454,6 @@ class Instance(
66006
66454
 
66007
66455
  Example::
66008
66456
 
66009
- # Example automatically generated from non-compiling source. May contain errors.
66010
66457
  # vpc: ec2.Vpc
66011
66458
  # instance_type: ec2.InstanceType
66012
66459
 
@@ -66014,12 +66461,9 @@ class Instance(
66014
66461
  ec2.Instance(self, "Instance",
66015
66462
  vpc=vpc,
66016
66463
  instance_type=instance_type,
66017
- machine_image=ec2.MachineImage.latest_amazon_linux(
66018
- # Amazon Linux 2 uses SystemD
66019
- generation=ec2.AmazonLinuxGeneration, AMAZON_LINUX_2=AMAZON_LINUX_2
66020
- ),
66464
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(),
66021
66465
 
66022
- init=ec2.CloudFormationInit.from_elements([
66466
+ init=ec2.CloudFormationInit.from_elements(
66023
66467
  # Create a simple config file that runs a Python web server
66024
66468
  ec2.InitService.systemd_config_file("simpleserver",
66025
66469
  command="/usr/bin/python3 -m http.server 8080",
@@ -66030,8 +66474,7 @@ class Instance(
66030
66474
  service_manager=ec2.ServiceManager.SYSTEMD
66031
66475
  ),
66032
66476
  # Drop an example file to show the web server working
66033
- ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!")
66034
- ])
66477
+ ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!"))
66035
66478
  )
66036
66479
  '''
66037
66480
 
@@ -66773,7 +67216,6 @@ class InstanceProps:
66773
67216
 
66774
67217
  Example::
66775
67218
 
66776
- # Example automatically generated from non-compiling source. May contain errors.
66777
67219
  # vpc: ec2.Vpc
66778
67220
  # instance_type: ec2.InstanceType
66779
67221
 
@@ -66781,12 +67223,9 @@ class InstanceProps:
66781
67223
  ec2.Instance(self, "Instance",
66782
67224
  vpc=vpc,
66783
67225
  instance_type=instance_type,
66784
- machine_image=ec2.MachineImage.latest_amazon_linux(
66785
- # Amazon Linux 2 uses SystemD
66786
- generation=ec2.AmazonLinuxGeneration, AMAZON_LINUX_2=AMAZON_LINUX_2
66787
- ),
67226
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(),
66788
67227
 
66789
- init=ec2.CloudFormationInit.from_elements([
67228
+ init=ec2.CloudFormationInit.from_elements(
66790
67229
  # Create a simple config file that runs a Python web server
66791
67230
  ec2.InitService.systemd_config_file("simpleserver",
66792
67231
  command="/usr/bin/python3 -m http.server 8080",
@@ -66797,8 +67236,7 @@ class InstanceProps:
66797
67236
  service_manager=ec2.ServiceManager.SYSTEMD
66798
67237
  ),
66799
67238
  # Drop an example file to show the web server working
66800
- ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!")
66801
- ])
67239
+ ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!"))
66802
67240
  )
66803
67241
  '''
66804
67242
  if isinstance(init_options, dict):
@@ -67029,7 +67467,6 @@ class InstanceProps:
67029
67467
 
67030
67468
  Example::
67031
67469
 
67032
- # Example automatically generated from non-compiling source. May contain errors.
67033
67470
  role = iam.Role(self, "MyRole",
67034
67471
  assumed_by=iam.ServicePrincipal("ec2.amazonaws.com")
67035
67472
  )
@@ -67153,7 +67590,6 @@ class InstanceRequireImdsv2Aspect(
67153
67590
 
67154
67591
  Example::
67155
67592
 
67156
- # Example automatically generated from non-compiling source. May contain errors.
67157
67593
  aspect = ec2.InstanceRequireImdsv2Aspect()
67158
67594
  Aspects.of(self).add(aspect)
67159
67595
  '''
@@ -67293,25 +67729,20 @@ class InstanceSize(enum.Enum):
67293
67729
 
67294
67730
  Example::
67295
67731
 
67296
- # build: gamelift.Build
67297
-
67732
+ # vpc: ec2.Vpc
67298
67733
 
67299
- fleet = gamelift.BuildFleet(self, "Game server fleet",
67300
- fleet_name="test-fleet",
67301
- content=build,
67302
- instance_type=ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
67303
- runtime_configuration=gamelift.RuntimeConfiguration(
67304
- server_processes=[gamelift.ServerProcess(
67305
- launch_path="/local/game/GameLiftExampleServer.x86_64"
67306
- )]
67307
- ),
67308
- ingress_rules=[gamelift.IngressRule(
67309
- source=gamelift.Peer.any_ipv4(),
67310
- port=gamelift.Port.tcp_range(100, 200)
67311
- )]
67734
+ cluster = rds.DatabaseCluster(self, "Database",
67735
+ engine=rds.DatabaseClusterEngine.aurora_mysql(version=rds.AuroraMysqlEngineVersion.VER_2_08_1),
67736
+ credentials=rds.Credentials.from_generated_secret("clusteradmin"), # Optional - will default to 'admin' username and generated password
67737
+ instance_props=rds.InstanceProps(
67738
+ # optional , defaults to t3.medium
67739
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL),
67740
+ vpc_subnets=ec2.SubnetSelection(
67741
+ subnet_type=ec2.SubnetType.PRIVATE_WITH_EGRESS
67742
+ ),
67743
+ vpc=vpc
67744
+ )
67312
67745
  )
67313
- # Allowing a specific CIDR for port 1111 on UDP Protocol
67314
- fleet.add_ingress_rule(gamelift.Peer.ipv4("1.2.3.4/32"), gamelift.Port.udp(1111))
67315
67746
  '''
67316
67747
 
67317
67748
  NANO = "NANO"
@@ -68831,7 +69262,6 @@ class InterfaceVpcEndpointProps(InterfaceVpcEndpointOptions):
68831
69262
 
68832
69263
  Example::
68833
69264
 
68834
- # Example automatically generated from non-compiling source. May contain errors.
68835
69265
  # vpc: ec2.Vpc
68836
69266
 
68837
69267
 
@@ -68968,7 +69398,6 @@ class InterfaceVpcEndpointService(
68968
69398
 
68969
69399
  Example::
68970
69400
 
68971
- # Example automatically generated from non-compiling source. May contain errors.
68972
69401
  # vpc: ec2.Vpc
68973
69402
 
68974
69403
 
@@ -69024,18 +69453,51 @@ class IpAddresses(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_ec2.IpAddr
69024
69453
 
69025
69454
  Example::
69026
69455
 
69027
- # Example automatically generated from non-compiling source. May contain errors.
69028
- from aws_cdk.aws_ec2 import IpAddresses
69456
+ vpc = ec2.Vpc(self, "TheVPC",
69457
+ # 'IpAddresses' configures the IP range and size of the entire VPC.
69458
+ # The IP space will be divided based on configuration for the subnets.
69459
+ ip_addresses=ec2.IpAddresses.cidr("10.0.0.0/21"),
69460
+
69461
+ # 'maxAzs' configures the maximum number of availability zones to use.
69462
+ # If you want to specify the exact availability zones you want the VPC
69463
+ # to use, use `availabilityZones` instead.
69464
+ max_azs=3,
69029
69465
 
69030
- # pool: ec2.CfnIPAMPool
69466
+ # 'subnetConfiguration' specifies the "subnet groups" to create.
69467
+ # Every subnet group will have a subnet for each AZ, so this
69468
+ # configuration will create `3 groups × 3 AZs = 9` subnets.
69469
+ subnet_configuration=[ec2.SubnetConfiguration(
69470
+ # 'subnetType' controls Internet access, as described above.
69471
+ subnet_type=ec2.SubnetType.PUBLIC,
69031
69472
 
69473
+ # 'name' is used to name this particular subnet group. You will have to
69474
+ # use the name for subnet selection if you have more than one subnet
69475
+ # group of the same type.
69476
+ name="Ingress",
69032
69477
 
69033
- ec2.Vpc(stack, "TheVPC",
69034
- ip_addresses=ec2.IpAddresses.aws_ipam_allocation(
69035
- ipv4_ipam_pool_id=pool.ref,
69036
- ipv4_netmask_length=18,
69037
- default_subnet_ipv4_netmask_length=24
69478
+ # 'cidrMask' specifies the IP addresses in the range of of individual
69479
+ # subnets in the group. Each of the subnets in this group will contain
69480
+ # `2^(32 address bits - 24 subnet bits) - 2 reserved addresses = 254`
69481
+ # usable IP addresses.
69482
+ #
69483
+ # If 'cidrMask' is left out the available address space is evenly
69484
+ # divided across the remaining subnet groups.
69485
+ cidr_mask=24
69486
+ ), ec2.SubnetConfiguration(
69487
+ cidr_mask=24,
69488
+ name="Application",
69489
+ subnet_type=ec2.SubnetType.PRIVATE_WITH_EGRESS
69490
+ ), ec2.SubnetConfiguration(
69491
+ cidr_mask=28,
69492
+ name="Database",
69493
+ subnet_type=ec2.SubnetType.PRIVATE_ISOLATED,
69494
+
69495
+ # 'reserved' can be used to reserve IP address space. No resources will
69496
+ # be created for this subnet, but the IP range will be kept available for
69497
+ # future creation of this subnet, or even for future subdivision.
69498
+ reserved=True
69038
69499
  )
69500
+ ]
69039
69501
  )
69040
69502
  '''
69041
69503
 
@@ -69094,14 +69556,11 @@ class LaunchTemplate(
69094
69556
 
69095
69557
  Example::
69096
69558
 
69097
- # Example automatically generated from non-compiling source. May contain errors.
69098
69559
  # vpc: ec2.Vpc
69099
69560
 
69100
69561
 
69101
69562
  template = ec2.LaunchTemplate(self, "LaunchTemplate",
69102
- machine_image=ec2.MachineImage.latest_amazon_linux(
69103
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2
69104
- ),
69563
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(),
69105
69564
  security_group=ec2.SecurityGroup(self, "LaunchTemplateSG",
69106
69565
  vpc=vpc
69107
69566
  )
@@ -69438,7 +69897,6 @@ class LaunchTemplateHttpTokens(enum.Enum):
69438
69897
 
69439
69898
  Example::
69440
69899
 
69441
- # Example automatically generated from non-compiling source. May contain errors.
69442
69900
  ec2.LaunchTemplate(self, "LaunchTemplate",
69443
69901
  http_endpoint=True,
69444
69902
  http_protocol_ipv6=True,
@@ -69542,14 +70000,11 @@ class LaunchTemplateProps:
69542
70000
 
69543
70001
  Example::
69544
70002
 
69545
- # Example automatically generated from non-compiling source. May contain errors.
69546
70003
  # vpc: ec2.Vpc
69547
70004
 
69548
70005
 
69549
70006
  template = ec2.LaunchTemplate(self, "LaunchTemplate",
69550
- machine_image=ec2.MachineImage.latest_amazon_linux(
69551
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2
69552
- ),
70007
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(),
69553
70008
  security_group=ec2.SecurityGroup(self, "LaunchTemplateSG",
69554
70009
  vpc=vpc
69555
70010
  )
@@ -69839,7 +70294,6 @@ class LaunchTemplateProps:
69839
70294
 
69840
70295
  Example::
69841
70296
 
69842
- # Example automatically generated from non-compiling source. May contain errors.
69843
70297
  role = iam.Role(self, "MyRole",
69844
70298
  assumed_by=iam.ServicePrincipal("ec2.amazonaws.com")
69845
70299
  )
@@ -70319,7 +70773,6 @@ class LogFormat(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_ec2.LogForma
70319
70773
 
70320
70774
  Example::
70321
70775
 
70322
- # Example automatically generated from non-compiling source. May contain errors.
70323
70776
  vpc = ec2.Vpc(self, "Vpc")
70324
70777
 
70325
70778
  vpc.add_flow_log("FlowLog",
@@ -70933,7 +71386,7 @@ class MachineImage(
70933
71386
  user_data: typing.Optional["UserData"] = None,
70934
71387
  virtualization: typing.Optional[AmazonLinuxVirt] = None,
70935
71388
  ) -> IMachineImage:
70936
- '''An Amazon Linux image that is automatically kept up-to-date.
71389
+ '''(deprecated) An Amazon Linux image that is automatically kept up-to-date.
70937
71390
 
70938
71391
  This Machine Image automatically updates to the latest version on every
70939
71392
  deployment. Be aware this will cause your instances to be replaced when a
@@ -70947,7 +71400,6 @@ class MachineImage(
70947
71400
 
70948
71401
  Specify the desired generation using the ``generation`` property::
70949
71402
 
70950
- # Example automatically generated from non-compiling source. May contain errors.
70951
71403
  ec2.MachineImage.latest_amazon_linux(
70952
71404
  # Use Amazon Linux 2
70953
71405
  generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2
@@ -70961,6 +71413,10 @@ class MachineImage(
70961
71413
  :param storage: What storage backed image to use. Default: GeneralPurpose
70962
71414
  :param user_data: Initial user data. Default: - Empty UserData for Linux machines
70963
71415
  :param virtualization: Virtualization type. Default: HVM
71416
+
71417
+ :deprecated: use MachineImage.latestAmazonLinux2 instead
71418
+
71419
+ :stability: deprecated
70964
71420
  '''
70965
71421
  props = AmazonLinuxImageProps(
70966
71422
  cached_in_context=cached_in_context,
@@ -70975,6 +71431,114 @@ class MachineImage(
70975
71431
 
70976
71432
  return typing.cast(IMachineImage, jsii.sinvoke(cls, "latestAmazonLinux", [props]))
70977
71433
 
71434
+ @jsii.member(jsii_name="latestAmazonLinux2")
71435
+ @builtins.classmethod
71436
+ def latest_amazon_linux2(
71437
+ cls,
71438
+ *,
71439
+ kernel: typing.Optional[AmazonLinux2Kernel] = None,
71440
+ storage: typing.Optional[AmazonLinuxStorage] = None,
71441
+ virtualization: typing.Optional[AmazonLinuxVirt] = None,
71442
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
71443
+ edition: typing.Optional[AmazonLinuxEdition] = None,
71444
+ cached_in_context: typing.Optional[builtins.bool] = None,
71445
+ user_data: typing.Optional["UserData"] = None,
71446
+ ) -> IMachineImage:
71447
+ '''An Amazon Linux 2 image that is automatically kept up-to-date.
71448
+
71449
+ This Machine Image automatically updates to the latest version on every
71450
+ deployment. Be aware this will cause your instances to be replaced when a
71451
+ new version of the image becomes available. Do not store stateful information
71452
+ on the instance if you are using this image.
71453
+
71454
+ :param kernel: What kernel version of Amazon Linux to use. Default: -
71455
+ :param storage: What storage backed image to use. Default: GeneralPurpose
71456
+ :param virtualization: Virtualization type. Default: HVM
71457
+ :param cpu_type: CPU Type. Default: AmazonLinuxCpuType.X86_64
71458
+ :param edition: What edition of Amazon Linux to use. Default: AmazonLinuxEdition.Standard
71459
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
71460
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
71461
+ '''
71462
+ props = AmazonLinux2ImageSsmParameterProps(
71463
+ kernel=kernel,
71464
+ storage=storage,
71465
+ virtualization=virtualization,
71466
+ cpu_type=cpu_type,
71467
+ edition=edition,
71468
+ cached_in_context=cached_in_context,
71469
+ user_data=user_data,
71470
+ )
71471
+
71472
+ return typing.cast(IMachineImage, jsii.sinvoke(cls, "latestAmazonLinux2", [props]))
71473
+
71474
+ @jsii.member(jsii_name="latestAmazonLinux2022")
71475
+ @builtins.classmethod
71476
+ def latest_amazon_linux2022(
71477
+ cls,
71478
+ *,
71479
+ kernel: typing.Optional[AmazonLinux2022Kernel] = None,
71480
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
71481
+ edition: typing.Optional[AmazonLinuxEdition] = None,
71482
+ cached_in_context: typing.Optional[builtins.bool] = None,
71483
+ user_data: typing.Optional["UserData"] = None,
71484
+ ) -> IMachineImage:
71485
+ '''An Amazon Linux 2022 image that is automatically kept up-to-date.
71486
+
71487
+ This Machine Image automatically updates to the latest version on every
71488
+ deployment. Be aware this will cause your instances to be replaced when a
71489
+ new version of the image becomes available. Do not store stateful information
71490
+ on the instance if you are using this image.
71491
+
71492
+ :param kernel: What kernel version of Amazon Linux to use. Default: AmazonLinux2022Kernel.DEFAULT
71493
+ :param cpu_type: CPU Type. Default: AmazonLinuxCpuType.X86_64
71494
+ :param edition: What edition of Amazon Linux to use. Default: AmazonLinuxEdition.Standard
71495
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
71496
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
71497
+ '''
71498
+ props = AmazonLinux2022ImageSsmParameterProps(
71499
+ kernel=kernel,
71500
+ cpu_type=cpu_type,
71501
+ edition=edition,
71502
+ cached_in_context=cached_in_context,
71503
+ user_data=user_data,
71504
+ )
71505
+
71506
+ return typing.cast(IMachineImage, jsii.sinvoke(cls, "latestAmazonLinux2022", [props]))
71507
+
71508
+ @jsii.member(jsii_name="latestAmazonLinux2023")
71509
+ @builtins.classmethod
71510
+ def latest_amazon_linux2023(
71511
+ cls,
71512
+ *,
71513
+ kernel: typing.Optional[AmazonLinux2023Kernel] = None,
71514
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
71515
+ edition: typing.Optional[AmazonLinuxEdition] = None,
71516
+ cached_in_context: typing.Optional[builtins.bool] = None,
71517
+ user_data: typing.Optional["UserData"] = None,
71518
+ ) -> IMachineImage:
71519
+ '''An Amazon Linux 2023 image that is automatically kept up-to-date.
71520
+
71521
+ This Machine Image automatically updates to the latest version on every
71522
+ deployment. Be aware this will cause your instances to be replaced when a
71523
+ new version of the image becomes available. Do not store stateful information
71524
+ on the instance if you are using this image.
71525
+
71526
+ :param kernel: What kernel version of Amazon Linux to use. Default: AmazonLinux2023Kernel.DEFAULT
71527
+ :param cpu_type: CPU Type. Default: AmazonLinuxCpuType.X86_64
71528
+ :param edition: What edition of Amazon Linux to use. Default: AmazonLinuxEdition.Standard
71529
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
71530
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
71531
+ '''
71532
+ props = AmazonLinux2023ImageSsmParameterProps(
71533
+ kernel=kernel,
71534
+ cpu_type=cpu_type,
71535
+ edition=edition,
71536
+ cached_in_context=cached_in_context,
71537
+ user_data=user_data,
71538
+ )
71539
+
71540
+ return typing.cast(IMachineImage, jsii.sinvoke(cls, "latestAmazonLinux2023", [props]))
71541
+
70978
71542
  @jsii.member(jsii_name="latestWindows")
70979
71543
  @builtins.classmethod
70980
71544
  def latest_windows(
@@ -71137,7 +71701,6 @@ class MultipartBody(
71137
71701
 
71138
71702
  Example::
71139
71703
 
71140
- # Example automatically generated from non-compiling source. May contain errors.
71141
71704
  multipart_user_data = ec2.MultipartUserData()
71142
71705
  commands_user_data = ec2.UserData.for_linux()
71143
71706
  multipart_user_data.add_user_data_part(commands_user_data, ec2.MultipartBody.SHELL_SCRIPT, True)
@@ -71642,7 +72205,6 @@ class NatInstanceProps:
71642
72205
 
71643
72206
  If you have a specific AMI ID you want to use, pass a ``GenericLinuxImage``. For example::
71644
72207
 
71645
- # Example automatically generated from non-compiling source. May contain errors.
71646
72208
  ec2.NatProvider.instance(
71647
72209
  instance_type=ec2.InstanceType("t3.micro"),
71648
72210
  machine_image=ec2.GenericLinuxImage({
@@ -71853,7 +72415,6 @@ class NatTrafficDirection(enum.Enum):
71853
72415
 
71854
72416
  Example::
71855
72417
 
71856
- # Example automatically generated from non-compiling source. May contain errors.
71857
72418
  # instance_type: ec2.InstanceType
71858
72419
 
71859
72420
 
@@ -72474,7 +73035,6 @@ class Peer(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_ec2.Peer"):
72474
73035
 
72475
73036
  Example::
72476
73037
 
72477
- # Example automatically generated from non-compiling source. May contain errors.
72478
73038
  # instance_type: ec2.InstanceType
72479
73039
 
72480
73040
 
@@ -72847,7 +73407,6 @@ class Port(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_ec2.Port"):
72847
73407
 
72848
73408
  Example::
72849
73409
 
72850
- # Example automatically generated from non-compiling source. May contain errors.
72851
73410
  # instance_type: ec2.InstanceType
72852
73411
 
72853
73412
 
@@ -73385,7 +73944,6 @@ class RouterType(enum.Enum):
73385
73944
 
73386
73945
  Example::
73387
73946
 
73388
- # Example automatically generated from non-compiling source. May contain errors.
73389
73947
  vpc = ec2.Vpc(self, "VPC",
73390
73948
  subnet_configuration=[ec2.SubnetConfiguration(
73391
73949
  subnet_type=ec2.SubnetType.PUBLIC,
@@ -73606,7 +74164,6 @@ class S3DownloadOptions:
73606
74164
 
73607
74165
  Example::
73608
74166
 
73609
- # Example automatically generated from non-compiling source. May contain errors.
73610
74167
  from aws_cdk.aws_s3_assets import Asset
73611
74168
 
73612
74169
  # instance: ec2.Instance
@@ -73724,7 +74281,6 @@ class SecurityGroup(
73724
74281
  If you have an existing security group you want to use in your CDK application,
73725
74282
  you would import it like this::
73726
74283
 
73727
- # Example automatically generated from non-compiling source. May contain errors.
73728
74284
  security_group = ec2.SecurityGroup.from_security_group_id(self, "SG", "sg-12345",
73729
74285
  mutable=False
73730
74286
  )
@@ -73733,14 +74289,11 @@ class SecurityGroup(
73733
74289
 
73734
74290
  Example::
73735
74291
 
73736
- # Example automatically generated from non-compiling source. May contain errors.
73737
74292
  # vpc: ec2.Vpc
73738
74293
 
73739
74294
 
73740
74295
  template = ec2.LaunchTemplate(self, "LaunchTemplate",
73741
- machine_image=ec2.MachineImage.latest_amazon_linux(
73742
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2
73743
- ),
74296
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(),
73744
74297
  security_group=ec2.SecurityGroup(self, "LaunchTemplateSG",
73745
74298
  vpc=vpc
73746
74299
  )
@@ -74099,7 +74652,6 @@ class SecurityGroupImportOptions:
74099
74652
 
74100
74653
  Example::
74101
74654
 
74102
- # Example automatically generated from non-compiling source. May contain errors.
74103
74655
  security_group = ec2.SecurityGroup.from_security_group_id(self, "SG", "sg-12345",
74104
74656
  mutable=False
74105
74657
  )
@@ -74198,22 +74750,29 @@ class SecurityGroupProps:
74198
74750
  :param disable_inline_rules: Whether to disable inline ingress and egress rule optimization. If this is set to true, ingress and egress rules will not be declared under the SecurityGroup in cloudformation, but will be separate elements. Inlining rules is an optimization for producing smaller stack templates. Sometimes this is not desirable, for example when security group access is managed via tags. The default value can be overriden globally by setting the context variable '@aws-cdk/aws-ec2.securityGroupDisableInlineRules'. Default: false
74199
74751
  :param security_group_name: The name of the security group. For valid values, see the GroupName parameter of the CreateSecurityGroup action in the Amazon EC2 API Reference. It is not recommended to use an explicit group name. Default: If you don't specify a GroupName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
74200
74752
 
74201
- :exampleMetadata: infused
74753
+ :exampleMetadata: fixture=with-vpc infused
74202
74754
 
74203
74755
  Example::
74204
74756
 
74205
- # Example automatically generated from non-compiling source. May contain errors.
74206
- # vpc: ec2.Vpc
74757
+ # Stack 1
74758
+ # stack1: Stack
74759
+ # stack2: Stack
74207
74760
 
74208
74761
 
74209
- template = ec2.LaunchTemplate(self, "LaunchTemplate",
74210
- machine_image=ec2.MachineImage.latest_amazon_linux(
74211
- generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2
74212
- ),
74213
- security_group=ec2.SecurityGroup(self, "LaunchTemplateSG",
74214
- vpc=vpc
74215
- )
74762
+ sg1 = ec2.SecurityGroup(stack1, "SG1",
74763
+ allow_all_outbound=False, # if this is `true` then no egress rule will be created
74764
+ vpc=vpc
74216
74765
  )
74766
+
74767
+ # Stack 2
74768
+ sg2 = ec2.SecurityGroup(stack2, "SG2",
74769
+ allow_all_outbound=False, # if this is `true` then no egress rule will be created
74770
+ vpc=vpc
74771
+ )
74772
+
74773
+ # `connections.allowTo` on `sg1` since we want the
74774
+ # rules to be created in Stack1
74775
+ sg1.connections.allow_to(sg2, ec2.Port.tcp(3333))
74217
74776
  '''
74218
74777
  if __debug__:
74219
74778
  type_hints = typing.get_type_hints(_typecheckingstub__4e55e0c52b51f92e83b1f8d6b7a5b22268d0369a14dab808b8f2f5f233e5b622)
@@ -74367,9 +74926,8 @@ class SelectedSubnets:
74367
74926
 
74368
74927
  Example::
74369
74928
 
74370
- # Example automatically generated from non-compiling source. May contain errors.
74371
74929
  vpc = ec2.Vpc(self, "TheVPC",
74372
- ip_addresses=IpAddresses.cidr("10.0.0.0/16")
74930
+ ip_addresses=ec2.IpAddresses.cidr("10.0.0.0/16")
74373
74931
  )
74374
74932
 
74375
74933
  # Iterate the private subnets
@@ -74469,7 +75027,6 @@ class ServiceManager(enum.Enum):
74469
75027
 
74470
75028
  Example::
74471
75029
 
74472
- # Example automatically generated from non-compiling source. May contain errors.
74473
75030
  # vpc: ec2.Vpc
74474
75031
  # instance_type: ec2.InstanceType
74475
75032
 
@@ -74477,12 +75034,9 @@ class ServiceManager(enum.Enum):
74477
75034
  ec2.Instance(self, "Instance",
74478
75035
  vpc=vpc,
74479
75036
  instance_type=instance_type,
74480
- machine_image=ec2.MachineImage.latest_amazon_linux(
74481
- # Amazon Linux 2 uses SystemD
74482
- generation=ec2.AmazonLinuxGeneration, AMAZON_LINUX_2=AMAZON_LINUX_2
74483
- ),
75037
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(),
74484
75038
 
74485
- init=ec2.CloudFormationInit.from_elements([
75039
+ init=ec2.CloudFormationInit.from_elements(
74486
75040
  # Create a simple config file that runs a Python web server
74487
75041
  ec2.InitService.systemd_config_file("simpleserver",
74488
75042
  command="/usr/bin/python3 -m http.server 8080",
@@ -74493,8 +75047,7 @@ class ServiceManager(enum.Enum):
74493
75047
  service_manager=ec2.ServiceManager.SYSTEMD
74494
75048
  ),
74495
75049
  # Drop an example file to show the web server working
74496
- ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!")
74497
- ])
75050
+ ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!"))
74498
75051
  )
74499
75052
  '''
74500
75053
 
@@ -75002,7 +75555,6 @@ class SubnetAttributes:
75002
75555
 
75003
75556
  Example::
75004
75557
 
75005
- # Example automatically generated from non-compiling source. May contain errors.
75006
75558
  # Supply all properties
75007
75559
  subnet1 = ec2.Subnet.from_subnet_attributes(self, "SubnetFromAttributes",
75008
75560
  subnet_id="s-1234",
@@ -75954,7 +76506,6 @@ class SystemdConfigFileOptions:
75954
76506
 
75955
76507
  Example::
75956
76508
 
75957
- # Example automatically generated from non-compiling source. May contain errors.
75958
76509
  # vpc: ec2.Vpc
75959
76510
  # instance_type: ec2.InstanceType
75960
76511
 
@@ -75962,12 +76513,9 @@ class SystemdConfigFileOptions:
75962
76513
  ec2.Instance(self, "Instance",
75963
76514
  vpc=vpc,
75964
76515
  instance_type=instance_type,
75965
- machine_image=ec2.MachineImage.latest_amazon_linux(
75966
- # Amazon Linux 2 uses SystemD
75967
- generation=ec2.AmazonLinuxGeneration, AMAZON_LINUX_2=AMAZON_LINUX_2
75968
- ),
76516
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(),
75969
76517
 
75970
- init=ec2.CloudFormationInit.from_elements([
76518
+ init=ec2.CloudFormationInit.from_elements(
75971
76519
  # Create a simple config file that runs a Python web server
75972
76520
  ec2.InitService.systemd_config_file("simpleserver",
75973
76521
  command="/usr/bin/python3 -m http.server 8080",
@@ -75978,8 +76526,7 @@ class SystemdConfigFileOptions:
75978
76526
  service_manager=ec2.ServiceManager.SYSTEMD
75979
76527
  ),
75980
76528
  # Drop an example file to show the web server working
75981
- ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!")
75982
- ])
76529
+ ec2.InitFile.from_string("/var/www/html/index.html", "Hello! It's working!"))
75983
76530
  )
75984
76531
  '''
75985
76532
  if __debug__:
@@ -76113,23 +76660,13 @@ class UserData(
76113
76660
 
76114
76661
  Example::
76115
76662
 
76116
- # cluster: eks.Cluster
76663
+ multipart_user_data = ec2.MultipartUserData()
76664
+ commands_user_data = ec2.UserData.for_linux()
76665
+ multipart_user_data.add_user_data_part(commands_user_data, ec2.MultipartBody.SHELL_SCRIPT, True)
76117
76666
 
76118
- user_data = ec2.UserData.for_linux()
76119
- user_data.add_commands("set -o xtrace", f"/etc/eks/bootstrap.sh {cluster.clusterName}")
76120
- lt = ec2.CfnLaunchTemplate(self, "LaunchTemplate",
76121
- launch_template_data=ec2.CfnLaunchTemplate.LaunchTemplateDataProperty(
76122
- image_id="some-ami-id", # custom AMI
76123
- instance_type="t3.small",
76124
- user_data=Fn.base64(user_data.render())
76125
- )
76126
- )
76127
- cluster.add_nodegroup_capacity("extra-ng",
76128
- launch_template_spec=eks.LaunchTemplateSpec(
76129
- id=lt.ref,
76130
- version=lt.attr_latest_version_number
76131
- )
76132
- )
76667
+ # Adding commands to the multipartUserData adds them to commandsUserData, and vice-versa.
76668
+ multipart_user_data.add_commands("touch /root/multi.txt")
76669
+ commands_user_data.add_commands("touch /root/userdata.txt")
76133
76670
  '''
76134
76671
 
76135
76672
  def __init__(self) -> None:
@@ -76349,7 +76886,6 @@ class Volume(
76349
76886
 
76350
76887
  Example::
76351
76888
 
76352
- # Example automatically generated from non-compiling source. May contain errors.
76353
76889
  # instance: ec2.Instance
76354
76890
  # role: iam.Role
76355
76891
 
@@ -76753,7 +77289,6 @@ class VolumeProps:
76753
77289
 
76754
77290
  Example::
76755
77291
 
76756
- # Example automatically generated from non-compiling source. May contain errors.
76757
77292
  # instance: ec2.Instance
76758
77293
  # role: iam.Role
76759
77294
 
@@ -76992,9 +77527,8 @@ class Vpc(
76992
77527
 
76993
77528
  For example::
76994
77529
 
76995
- # Example automatically generated from non-compiling source. May contain errors.
76996
77530
  vpc = ec2.Vpc(self, "TheVPC",
76997
- ip_addresses=IpAddresses.cidr("10.0.0.0/16")
77531
+ ip_addresses=ec2.IpAddresses.cidr("10.0.0.0/16")
76998
77532
  )
76999
77533
 
77000
77534
  # Iterate the private subnets
@@ -77752,7 +78286,6 @@ class VpcAttributes:
77752
78286
 
77753
78287
  Example::
77754
78288
 
77755
- # Example automatically generated from non-compiling source. May contain errors.
77756
78289
  vpc = ec2.Vpc.from_vpc_attributes(self, "VPC",
77757
78290
  vpc_id="vpc-1234",
77758
78291
  availability_zones=["us-east-1a", "us-east-1b"],
@@ -78116,7 +78649,6 @@ class VpcEndpointService(
78116
78649
 
78117
78650
  Example::
78118
78651
 
78119
- # Example automatically generated from non-compiling source. May contain errors.
78120
78652
  # network_load_balancer1: elbv2.NetworkLoadBalancer
78121
78653
  # network_load_balancer2: elbv2.NetworkLoadBalancer
78122
78654
 
@@ -78225,7 +78757,6 @@ class VpcEndpointServiceProps:
78225
78757
 
78226
78758
  Example::
78227
78759
 
78228
- # Example automatically generated from non-compiling source. May contain errors.
78229
78760
  # network_load_balancer1: elbv2.NetworkLoadBalancer
78230
78761
  # network_load_balancer2: elbv2.NetworkLoadBalancer
78231
78762
 
@@ -78946,7 +79477,6 @@ class VpcProps:
78946
79477
  For example, if you want 1 public subnet, 1 private subnet, and 1 isolated
78947
79478
  subnet in each AZ provide the following::
78948
79479
 
78949
- # Example automatically generated from non-compiling source. May contain errors.
78950
79480
  ec2.Vpc(self, "VPC",
78951
79481
  subnet_configuration=[ec2.SubnetConfiguration(
78952
79482
  cidr_mask=24,
@@ -79419,7 +79949,6 @@ class VpnConnectionOptions:
79419
79949
 
79420
79950
  Example::
79421
79951
 
79422
- # Example automatically generated from non-compiling source. May contain errors.
79423
79952
  vpc = ec2.Vpc(self, "MyVpc",
79424
79953
  vpn_connections={
79425
79954
  "dynamic": ec2.VpnConnectionOptions( # Dynamic routing (BGP)
@@ -79939,17 +80468,11 @@ class WindowsUserDataOptions:
79939
80468
 
79940
80469
  :param persist: Set to true to set this userdata to persist through an instance reboot; allowing it to run on every instance start. By default, UserData is run only once during the first instance launch. For more information, see: https://aws.amazon.com/premiumsupport/knowledge-center/execute-user-data-ec2/ https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html#user-data-scripts Default: false
79941
80470
 
79942
- :exampleMetadata: fixture=_generated
80471
+ :exampleMetadata: infused
79943
80472
 
79944
80473
  Example::
79945
80474
 
79946
- # The code below shows an example of how to instantiate this type.
79947
- # The values are placeholders you should change.
79948
- from aws_cdk import aws_ec2 as ec2
79949
-
79950
- windows_user_data_options = ec2.WindowsUserDataOptions(
79951
- persist=False
79952
- )
80475
+ windows_user_data = ec2.UserData.for_windows(persist=True)
79953
80476
  '''
79954
80477
  if __debug__:
79955
80478
  type_hints = typing.get_type_hints(_typecheckingstub__a9243d0fea7f4d4e8b65c37925a1dbb71b6136866e6c28c37f9d5dc79df4716d)
@@ -80281,6 +80804,518 @@ class WindowsVersion(enum.Enum):
80281
80804
  WINDOWS_SERVER_2022_SWEDISH_FULL_BASE = "WINDOWS_SERVER_2022_SWEDISH_FULL_BASE"
80282
80805
 
80283
80806
 
80807
+ @jsii.data_type(
80808
+ jsii_type="aws-cdk-lib.aws_ec2.AmazonLinux2022ImageSsmParameterProps",
80809
+ jsii_struct_bases=[AmazonLinuxImageSsmParameterCommonOptions],
80810
+ name_mapping={
80811
+ "cached_in_context": "cachedInContext",
80812
+ "user_data": "userData",
80813
+ "cpu_type": "cpuType",
80814
+ "edition": "edition",
80815
+ "kernel": "kernel",
80816
+ },
80817
+ )
80818
+ class AmazonLinux2022ImageSsmParameterProps(AmazonLinuxImageSsmParameterCommonOptions):
80819
+ def __init__(
80820
+ self,
80821
+ *,
80822
+ cached_in_context: typing.Optional[builtins.bool] = None,
80823
+ user_data: typing.Optional[UserData] = None,
80824
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
80825
+ edition: typing.Optional[AmazonLinuxEdition] = None,
80826
+ kernel: typing.Optional[AmazonLinux2022Kernel] = None,
80827
+ ) -> None:
80828
+ '''Properties specific to al2022 images.
80829
+
80830
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
80831
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
80832
+ :param cpu_type: CPU Type. Default: AmazonLinuxCpuType.X86_64
80833
+ :param edition: What edition of Amazon Linux to use. Default: AmazonLinuxEdition.Standard
80834
+ :param kernel: What kernel version of Amazon Linux to use. Default: AmazonLinux2022Kernel.DEFAULT
80835
+
80836
+ :exampleMetadata: infused
80837
+
80838
+ Example::
80839
+
80840
+ # Example automatically generated from non-compiling source. May contain errors.
80841
+ # vpc: ec2.Vpc
80842
+ # instance_type: ec2.InstanceType
80843
+
80844
+
80845
+ # Amazon Linux 2
80846
+ ec2.Instance(self, "Instance2",
80847
+ vpc=vpc,
80848
+ instance_type=instance_type,
80849
+ machine_image=ec2.MachineImage.latest_amazon_linux2()
80850
+ )
80851
+
80852
+ # Amazon Linux 2 with kernel 5.x
80853
+ ec2.Instance(self, "Instance3",
80854
+ vpc=vpc,
80855
+ instance_type=instance_type,
80856
+ machine_image=ec2.AmazonLinux2Image(
80857
+ kernel=ec2.AmazonLinux2Kernel.KERNEL_5_10
80858
+ )
80859
+ )
80860
+
80861
+ # AWS Linux 2022
80862
+ ec2.Instance(self, "Instance4",
80863
+ vpc=vpc,
80864
+ instance_type=instance_type,
80865
+ machine_image=ec2.MachineImage.latest_amazon_linux2022()
80866
+ )
80867
+
80868
+ # Graviton 3 Processor
80869
+ ec2.Instance(self, "Instance5",
80870
+ vpc=vpc,
80871
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
80872
+ machine_image=ec2.MachineImage.latest_amazon_linux2022(
80873
+ cpu_type=ec2.AmazonLinuxCpuType.ARM_64
80874
+ )
80875
+ )
80876
+ '''
80877
+ if __debug__:
80878
+ type_hints = typing.get_type_hints(_typecheckingstub__968329b6e3d88dbd1836e6234bc305a96628c570666cc423d4eeccc95dc92ab6)
80879
+ check_type(argname="argument cached_in_context", value=cached_in_context, expected_type=type_hints["cached_in_context"])
80880
+ check_type(argname="argument user_data", value=user_data, expected_type=type_hints["user_data"])
80881
+ check_type(argname="argument cpu_type", value=cpu_type, expected_type=type_hints["cpu_type"])
80882
+ check_type(argname="argument edition", value=edition, expected_type=type_hints["edition"])
80883
+ check_type(argname="argument kernel", value=kernel, expected_type=type_hints["kernel"])
80884
+ self._values: typing.Dict[builtins.str, typing.Any] = {}
80885
+ if cached_in_context is not None:
80886
+ self._values["cached_in_context"] = cached_in_context
80887
+ if user_data is not None:
80888
+ self._values["user_data"] = user_data
80889
+ if cpu_type is not None:
80890
+ self._values["cpu_type"] = cpu_type
80891
+ if edition is not None:
80892
+ self._values["edition"] = edition
80893
+ if kernel is not None:
80894
+ self._values["kernel"] = kernel
80895
+
80896
+ @builtins.property
80897
+ def cached_in_context(self) -> typing.Optional[builtins.bool]:
80898
+ '''Whether the AMI ID is cached to be stable between deployments.
80899
+
80900
+ By default, the newest image is used on each deployment. This will cause
80901
+ instances to be replaced whenever a new version is released, and may cause
80902
+ downtime if there aren't enough running instances in the AutoScalingGroup
80903
+ to reschedule the tasks on.
80904
+
80905
+ If set to true, the AMI ID will be cached in ``cdk.context.json`` and the
80906
+ same value will be used on future runs. Your instances will not be replaced
80907
+ but your AMI version will grow old over time. To refresh the AMI lookup,
80908
+ you will have to evict the value from the cache using the ``cdk context``
80909
+ command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
80910
+ more information.
80911
+
80912
+ Can not be set to ``true`` in environment-agnostic stacks.
80913
+
80914
+ :default: false
80915
+ '''
80916
+ result = self._values.get("cached_in_context")
80917
+ return typing.cast(typing.Optional[builtins.bool], result)
80918
+
80919
+ @builtins.property
80920
+ def user_data(self) -> typing.Optional[UserData]:
80921
+ '''Initial user data.
80922
+
80923
+ :default: - Empty UserData for Linux machines
80924
+ '''
80925
+ result = self._values.get("user_data")
80926
+ return typing.cast(typing.Optional[UserData], result)
80927
+
80928
+ @builtins.property
80929
+ def cpu_type(self) -> typing.Optional[AmazonLinuxCpuType]:
80930
+ '''CPU Type.
80931
+
80932
+ :default: AmazonLinuxCpuType.X86_64
80933
+ '''
80934
+ result = self._values.get("cpu_type")
80935
+ return typing.cast(typing.Optional[AmazonLinuxCpuType], result)
80936
+
80937
+ @builtins.property
80938
+ def edition(self) -> typing.Optional[AmazonLinuxEdition]:
80939
+ '''What edition of Amazon Linux to use.
80940
+
80941
+ :default: AmazonLinuxEdition.Standard
80942
+ '''
80943
+ result = self._values.get("edition")
80944
+ return typing.cast(typing.Optional[AmazonLinuxEdition], result)
80945
+
80946
+ @builtins.property
80947
+ def kernel(self) -> typing.Optional[AmazonLinux2022Kernel]:
80948
+ '''What kernel version of Amazon Linux to use.
80949
+
80950
+ :default: AmazonLinux2022Kernel.DEFAULT
80951
+ '''
80952
+ result = self._values.get("kernel")
80953
+ return typing.cast(typing.Optional[AmazonLinux2022Kernel], result)
80954
+
80955
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
80956
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
80957
+
80958
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
80959
+ return not (rhs == self)
80960
+
80961
+ def __repr__(self) -> str:
80962
+ return "AmazonLinux2022ImageSsmParameterProps(%s)" % ", ".join(
80963
+ k + "=" + repr(v) for k, v in self._values.items()
80964
+ )
80965
+
80966
+
80967
+ @jsii.data_type(
80968
+ jsii_type="aws-cdk-lib.aws_ec2.AmazonLinux2023ImageSsmParameterProps",
80969
+ jsii_struct_bases=[AmazonLinuxImageSsmParameterCommonOptions],
80970
+ name_mapping={
80971
+ "cached_in_context": "cachedInContext",
80972
+ "user_data": "userData",
80973
+ "cpu_type": "cpuType",
80974
+ "edition": "edition",
80975
+ "kernel": "kernel",
80976
+ },
80977
+ )
80978
+ class AmazonLinux2023ImageSsmParameterProps(AmazonLinuxImageSsmParameterCommonOptions):
80979
+ def __init__(
80980
+ self,
80981
+ *,
80982
+ cached_in_context: typing.Optional[builtins.bool] = None,
80983
+ user_data: typing.Optional[UserData] = None,
80984
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
80985
+ edition: typing.Optional[AmazonLinuxEdition] = None,
80986
+ kernel: typing.Optional[AmazonLinux2023Kernel] = None,
80987
+ ) -> None:
80988
+ '''Properties specific to al2023 images.
80989
+
80990
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
80991
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
80992
+ :param cpu_type: CPU Type. Default: AmazonLinuxCpuType.X86_64
80993
+ :param edition: What edition of Amazon Linux to use. Default: AmazonLinuxEdition.Standard
80994
+ :param kernel: What kernel version of Amazon Linux to use. Default: AmazonLinux2023Kernel.DEFAULT
80995
+
80996
+ :exampleMetadata: infused
80997
+
80998
+ Example::
80999
+
81000
+ # Example automatically generated from non-compiling source. May contain errors.
81001
+ ec2.Instance(self, "LatestAl2023",
81002
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
81003
+ machine_image=ec2.MachineImage.latest_amazon_linux2023(
81004
+ cached_in_context=True
81005
+ )
81006
+ )
81007
+
81008
+ # or
81009
+ ec2.Instance(self, "LatestAl2023",
81010
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
81011
+ # context cache is turned on by default
81012
+ machine_image=ec2.AmazonLinux2023ImageSsmParameter()
81013
+ )
81014
+ '''
81015
+ if __debug__:
81016
+ type_hints = typing.get_type_hints(_typecheckingstub__d2a291560388da3a1deca6cc63773b445813e32521bbcf4ece1d3a557e2eda6b)
81017
+ check_type(argname="argument cached_in_context", value=cached_in_context, expected_type=type_hints["cached_in_context"])
81018
+ check_type(argname="argument user_data", value=user_data, expected_type=type_hints["user_data"])
81019
+ check_type(argname="argument cpu_type", value=cpu_type, expected_type=type_hints["cpu_type"])
81020
+ check_type(argname="argument edition", value=edition, expected_type=type_hints["edition"])
81021
+ check_type(argname="argument kernel", value=kernel, expected_type=type_hints["kernel"])
81022
+ self._values: typing.Dict[builtins.str, typing.Any] = {}
81023
+ if cached_in_context is not None:
81024
+ self._values["cached_in_context"] = cached_in_context
81025
+ if user_data is not None:
81026
+ self._values["user_data"] = user_data
81027
+ if cpu_type is not None:
81028
+ self._values["cpu_type"] = cpu_type
81029
+ if edition is not None:
81030
+ self._values["edition"] = edition
81031
+ if kernel is not None:
81032
+ self._values["kernel"] = kernel
81033
+
81034
+ @builtins.property
81035
+ def cached_in_context(self) -> typing.Optional[builtins.bool]:
81036
+ '''Whether the AMI ID is cached to be stable between deployments.
81037
+
81038
+ By default, the newest image is used on each deployment. This will cause
81039
+ instances to be replaced whenever a new version is released, and may cause
81040
+ downtime if there aren't enough running instances in the AutoScalingGroup
81041
+ to reschedule the tasks on.
81042
+
81043
+ If set to true, the AMI ID will be cached in ``cdk.context.json`` and the
81044
+ same value will be used on future runs. Your instances will not be replaced
81045
+ but your AMI version will grow old over time. To refresh the AMI lookup,
81046
+ you will have to evict the value from the cache using the ``cdk context``
81047
+ command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
81048
+ more information.
81049
+
81050
+ Can not be set to ``true`` in environment-agnostic stacks.
81051
+
81052
+ :default: false
81053
+ '''
81054
+ result = self._values.get("cached_in_context")
81055
+ return typing.cast(typing.Optional[builtins.bool], result)
81056
+
81057
+ @builtins.property
81058
+ def user_data(self) -> typing.Optional[UserData]:
81059
+ '''Initial user data.
81060
+
81061
+ :default: - Empty UserData for Linux machines
81062
+ '''
81063
+ result = self._values.get("user_data")
81064
+ return typing.cast(typing.Optional[UserData], result)
81065
+
81066
+ @builtins.property
81067
+ def cpu_type(self) -> typing.Optional[AmazonLinuxCpuType]:
81068
+ '''CPU Type.
81069
+
81070
+ :default: AmazonLinuxCpuType.X86_64
81071
+ '''
81072
+ result = self._values.get("cpu_type")
81073
+ return typing.cast(typing.Optional[AmazonLinuxCpuType], result)
81074
+
81075
+ @builtins.property
81076
+ def edition(self) -> typing.Optional[AmazonLinuxEdition]:
81077
+ '''What edition of Amazon Linux to use.
81078
+
81079
+ :default: AmazonLinuxEdition.Standard
81080
+ '''
81081
+ result = self._values.get("edition")
81082
+ return typing.cast(typing.Optional[AmazonLinuxEdition], result)
81083
+
81084
+ @builtins.property
81085
+ def kernel(self) -> typing.Optional[AmazonLinux2023Kernel]:
81086
+ '''What kernel version of Amazon Linux to use.
81087
+
81088
+ :default: AmazonLinux2023Kernel.DEFAULT
81089
+ '''
81090
+ result = self._values.get("kernel")
81091
+ return typing.cast(typing.Optional[AmazonLinux2023Kernel], result)
81092
+
81093
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
81094
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
81095
+
81096
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
81097
+ return not (rhs == self)
81098
+
81099
+ def __repr__(self) -> str:
81100
+ return "AmazonLinux2023ImageSsmParameterProps(%s)" % ", ".join(
81101
+ k + "=" + repr(v) for k, v in self._values.items()
81102
+ )
81103
+
81104
+
81105
+ @jsii.data_type(
81106
+ jsii_type="aws-cdk-lib.aws_ec2.AmazonLinux2ImageSsmParameterProps",
81107
+ jsii_struct_bases=[AmazonLinuxImageSsmParameterCommonOptions],
81108
+ name_mapping={
81109
+ "cached_in_context": "cachedInContext",
81110
+ "user_data": "userData",
81111
+ "cpu_type": "cpuType",
81112
+ "edition": "edition",
81113
+ "kernel": "kernel",
81114
+ "storage": "storage",
81115
+ "virtualization": "virtualization",
81116
+ },
81117
+ )
81118
+ class AmazonLinux2ImageSsmParameterProps(AmazonLinuxImageSsmParameterCommonOptions):
81119
+ def __init__(
81120
+ self,
81121
+ *,
81122
+ cached_in_context: typing.Optional[builtins.bool] = None,
81123
+ user_data: typing.Optional[UserData] = None,
81124
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
81125
+ edition: typing.Optional[AmazonLinuxEdition] = None,
81126
+ kernel: typing.Optional[AmazonLinux2Kernel] = None,
81127
+ storage: typing.Optional[AmazonLinuxStorage] = None,
81128
+ virtualization: typing.Optional[AmazonLinuxVirt] = None,
81129
+ ) -> None:
81130
+ '''Properties specific to amzn2 images.
81131
+
81132
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
81133
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
81134
+ :param cpu_type: CPU Type. Default: AmazonLinuxCpuType.X86_64
81135
+ :param edition: What edition of Amazon Linux to use. Default: AmazonLinuxEdition.Standard
81136
+ :param kernel: What kernel version of Amazon Linux to use. Default: -
81137
+ :param storage: What storage backed image to use. Default: GeneralPurpose
81138
+ :param virtualization: Virtualization type. Default: HVM
81139
+
81140
+ :exampleMetadata: fixture=_generated
81141
+
81142
+ Example::
81143
+
81144
+ # The code below shows an example of how to instantiate this type.
81145
+ # The values are placeholders you should change.
81146
+ from aws_cdk import aws_ec2 as ec2
81147
+
81148
+ # amazon_linux2_kernel: ec2.AmazonLinux2Kernel
81149
+ # user_data: ec2.UserData
81150
+
81151
+ amazon_linux2_image_ssm_parameter_props = ec2.AmazonLinux2ImageSsmParameterProps(
81152
+ cached_in_context=False,
81153
+ cpu_type=ec2.AmazonLinuxCpuType.ARM_64,
81154
+ edition=ec2.AmazonLinuxEdition.STANDARD,
81155
+ kernel=amazon_linux2_kernel,
81156
+ storage=ec2.AmazonLinuxStorage.EBS,
81157
+ user_data=user_data,
81158
+ virtualization=ec2.AmazonLinuxVirt.HVM
81159
+ )
81160
+ '''
81161
+ if __debug__:
81162
+ type_hints = typing.get_type_hints(_typecheckingstub__8aa3dd8e9489482da5f68eebe827af2a2367490c7299028616bae30c26efbd55)
81163
+ check_type(argname="argument cached_in_context", value=cached_in_context, expected_type=type_hints["cached_in_context"])
81164
+ check_type(argname="argument user_data", value=user_data, expected_type=type_hints["user_data"])
81165
+ check_type(argname="argument cpu_type", value=cpu_type, expected_type=type_hints["cpu_type"])
81166
+ check_type(argname="argument edition", value=edition, expected_type=type_hints["edition"])
81167
+ check_type(argname="argument kernel", value=kernel, expected_type=type_hints["kernel"])
81168
+ check_type(argname="argument storage", value=storage, expected_type=type_hints["storage"])
81169
+ check_type(argname="argument virtualization", value=virtualization, expected_type=type_hints["virtualization"])
81170
+ self._values: typing.Dict[builtins.str, typing.Any] = {}
81171
+ if cached_in_context is not None:
81172
+ self._values["cached_in_context"] = cached_in_context
81173
+ if user_data is not None:
81174
+ self._values["user_data"] = user_data
81175
+ if cpu_type is not None:
81176
+ self._values["cpu_type"] = cpu_type
81177
+ if edition is not None:
81178
+ self._values["edition"] = edition
81179
+ if kernel is not None:
81180
+ self._values["kernel"] = kernel
81181
+ if storage is not None:
81182
+ self._values["storage"] = storage
81183
+ if virtualization is not None:
81184
+ self._values["virtualization"] = virtualization
81185
+
81186
+ @builtins.property
81187
+ def cached_in_context(self) -> typing.Optional[builtins.bool]:
81188
+ '''Whether the AMI ID is cached to be stable between deployments.
81189
+
81190
+ By default, the newest image is used on each deployment. This will cause
81191
+ instances to be replaced whenever a new version is released, and may cause
81192
+ downtime if there aren't enough running instances in the AutoScalingGroup
81193
+ to reschedule the tasks on.
81194
+
81195
+ If set to true, the AMI ID will be cached in ``cdk.context.json`` and the
81196
+ same value will be used on future runs. Your instances will not be replaced
81197
+ but your AMI version will grow old over time. To refresh the AMI lookup,
81198
+ you will have to evict the value from the cache using the ``cdk context``
81199
+ command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for
81200
+ more information.
81201
+
81202
+ Can not be set to ``true`` in environment-agnostic stacks.
81203
+
81204
+ :default: false
81205
+ '''
81206
+ result = self._values.get("cached_in_context")
81207
+ return typing.cast(typing.Optional[builtins.bool], result)
81208
+
81209
+ @builtins.property
81210
+ def user_data(self) -> typing.Optional[UserData]:
81211
+ '''Initial user data.
81212
+
81213
+ :default: - Empty UserData for Linux machines
81214
+ '''
81215
+ result = self._values.get("user_data")
81216
+ return typing.cast(typing.Optional[UserData], result)
81217
+
81218
+ @builtins.property
81219
+ def cpu_type(self) -> typing.Optional[AmazonLinuxCpuType]:
81220
+ '''CPU Type.
81221
+
81222
+ :default: AmazonLinuxCpuType.X86_64
81223
+ '''
81224
+ result = self._values.get("cpu_type")
81225
+ return typing.cast(typing.Optional[AmazonLinuxCpuType], result)
81226
+
81227
+ @builtins.property
81228
+ def edition(self) -> typing.Optional[AmazonLinuxEdition]:
81229
+ '''What edition of Amazon Linux to use.
81230
+
81231
+ :default: AmazonLinuxEdition.Standard
81232
+ '''
81233
+ result = self._values.get("edition")
81234
+ return typing.cast(typing.Optional[AmazonLinuxEdition], result)
81235
+
81236
+ @builtins.property
81237
+ def kernel(self) -> typing.Optional[AmazonLinux2Kernel]:
81238
+ '''What kernel version of Amazon Linux to use.
81239
+
81240
+ :default: -
81241
+ '''
81242
+ result = self._values.get("kernel")
81243
+ return typing.cast(typing.Optional[AmazonLinux2Kernel], result)
81244
+
81245
+ @builtins.property
81246
+ def storage(self) -> typing.Optional[AmazonLinuxStorage]:
81247
+ '''What storage backed image to use.
81248
+
81249
+ :default: GeneralPurpose
81250
+ '''
81251
+ result = self._values.get("storage")
81252
+ return typing.cast(typing.Optional[AmazonLinuxStorage], result)
81253
+
81254
+ @builtins.property
81255
+ def virtualization(self) -> typing.Optional[AmazonLinuxVirt]:
81256
+ '''Virtualization type.
81257
+
81258
+ :default: HVM
81259
+ '''
81260
+ result = self._values.get("virtualization")
81261
+ return typing.cast(typing.Optional[AmazonLinuxVirt], result)
81262
+
81263
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
81264
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
81265
+
81266
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
81267
+ return not (rhs == self)
81268
+
81269
+ def __repr__(self) -> str:
81270
+ return "AmazonLinux2ImageSsmParameterProps(%s)" % ", ".join(
81271
+ k + "=" + repr(v) for k, v in self._values.items()
81272
+ )
81273
+
81274
+
81275
+ @jsii.implements(IMachineImage)
81276
+ class AmazonLinuxImageSsmParameterBase(
81277
+ metaclass=jsii.JSIIAbstractClass,
81278
+ jsii_type="aws-cdk-lib.aws_ec2.AmazonLinuxImageSsmParameterBase",
81279
+ ):
81280
+ def __init__(
81281
+ self,
81282
+ *,
81283
+ parameter_name: builtins.str,
81284
+ cached_in_context: typing.Optional[builtins.bool] = None,
81285
+ user_data: typing.Optional[UserData] = None,
81286
+ ) -> None:
81287
+ '''
81288
+ :param parameter_name: The name of the SSM parameter that contains the AMI value.
81289
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
81290
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
81291
+ '''
81292
+ props = AmazonLinuxImageSsmParameterBaseProps(
81293
+ parameter_name=parameter_name,
81294
+ cached_in_context=cached_in_context,
81295
+ user_data=user_data,
81296
+ )
81297
+
81298
+ jsii.create(self.__class__, self, [props])
81299
+
81300
+ @jsii.member(jsii_name="getImage")
81301
+ def get_image(self, scope: _constructs_77d1e7e8.Construct) -> MachineImageConfig:
81302
+ '''Return the image to use in the given context.
81303
+
81304
+ :param scope: -
81305
+ '''
81306
+ if __debug__:
81307
+ type_hints = typing.get_type_hints(_typecheckingstub__cf74508a9d2ec0bb2e7646472ba3fe700482482a3d87536fb58694a37fa01191)
81308
+ check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
81309
+ return typing.cast(MachineImageConfig, jsii.invoke(self, "getImage", [scope]))
81310
+
81311
+
81312
+ class _AmazonLinuxImageSsmParameterBaseProxy(AmazonLinuxImageSsmParameterBase):
81313
+ pass
81314
+
81315
+ # Adding a "__jsii_proxy_class__(): typing.Type" function to the abstract class
81316
+ typing.cast(typing.Any, AmazonLinuxImageSsmParameterBase).__jsii_proxy_class__ = lambda : _AmazonLinuxImageSsmParameterBaseProxy
81317
+
81318
+
80284
81319
  @jsii.implements(IInstance)
80285
81320
  class BastionHostLinux(
80286
81321
  _Resource_45bc6135,
@@ -81233,7 +82268,6 @@ class FlowLog(
81233
82268
 
81234
82269
  Example::
81235
82270
 
81236
- # Example automatically generated from non-compiling source. May contain errors.
81237
82271
  # vpc: ec2.Vpc
81238
82272
 
81239
82273
 
@@ -81714,7 +82748,6 @@ class InitCommand(
81714
82748
 
81715
82749
  Example::
81716
82750
 
81717
- # Example automatically generated from non-compiling source. May contain errors.
81718
82751
  handle = ec2.InitServiceRestartHandle()
81719
82752
  ec2.CloudFormationInit.from_elements(
81720
82753
  ec2.InitCommand.shell_command("/usr/bin/custom-nginx-install.sh", service_restart_handles=[handle]),
@@ -82371,7 +83404,6 @@ class InterfaceVpcEndpoint(
82371
83404
 
82372
83405
  Example::
82373
83406
 
82374
- # Example automatically generated from non-compiling source. May contain errors.
82375
83407
  # vpc: ec2.Vpc
82376
83408
 
82377
83409
 
@@ -82522,7 +83554,6 @@ class MultipartUserData(
82522
83554
 
82523
83555
  Example::
82524
83556
 
82525
- # Example automatically generated from non-compiling source. May contain errors.
82526
83557
  boot_hook_conf = ec2.UserData.for_linux()
82527
83558
  boot_hook_conf.add_commands("cloud-init-per once docker_options echo 'OPTIONS=\"${OPTIONS} --storage-opt dm.basesize=40G\"' >> /etc/sysconfig/docker")
82528
83559
 
@@ -82650,7 +83681,6 @@ class MultipartUserData(
82650
83681
 
82651
83682
  If ``makeDefault`` is false, then this is the same as calling::
82652
83683
 
82653
- # Example automatically generated from non-compiling source. May contain errors.
82654
83684
  # multi_part: ec2.MultipartUserData
82655
83685
  # user_data: ec2.UserData
82656
83686
  # content_type: str
@@ -83726,6 +84756,302 @@ class WindowsImage(
83726
84756
  jsii.create(self.__class__, self, [version, props])
83727
84757
 
83728
84758
 
84759
+ class AmazonLinux2022ImageSsmParameter(
84760
+ AmazonLinuxImageSsmParameterBase,
84761
+ metaclass=jsii.JSIIMeta,
84762
+ jsii_type="aws-cdk-lib.aws_ec2.AmazonLinux2022ImageSsmParameter",
84763
+ ):
84764
+ '''A SSM Parameter that contains the AMI ID for Amazon Linux 2023.
84765
+
84766
+ :exampleMetadata: fixture=_generated
84767
+
84768
+ Example::
84769
+
84770
+ # The code below shows an example of how to instantiate this type.
84771
+ # The values are placeholders you should change.
84772
+ from aws_cdk import aws_ec2 as ec2
84773
+
84774
+ # amazon_linux2022_kernel: ec2.AmazonLinux2022Kernel
84775
+ # user_data: ec2.UserData
84776
+
84777
+ amazon_linux2022_image_ssm_parameter = ec2.AmazonLinux2022ImageSsmParameter(
84778
+ cached_in_context=False,
84779
+ cpu_type=ec2.AmazonLinuxCpuType.ARM_64,
84780
+ edition=ec2.AmazonLinuxEdition.STANDARD,
84781
+ kernel=amazon_linux2022_kernel,
84782
+ user_data=user_data
84783
+ )
84784
+ '''
84785
+
84786
+ def __init__(
84787
+ self,
84788
+ *,
84789
+ kernel: typing.Optional[AmazonLinux2022Kernel] = None,
84790
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
84791
+ edition: typing.Optional[AmazonLinuxEdition] = None,
84792
+ cached_in_context: typing.Optional[builtins.bool] = None,
84793
+ user_data: typing.Optional[UserData] = None,
84794
+ ) -> None:
84795
+ '''
84796
+ :param kernel: What kernel version of Amazon Linux to use. Default: AmazonLinux2022Kernel.DEFAULT
84797
+ :param cpu_type: CPU Type. Default: AmazonLinuxCpuType.X86_64
84798
+ :param edition: What edition of Amazon Linux to use. Default: AmazonLinuxEdition.Standard
84799
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
84800
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
84801
+ '''
84802
+ props = AmazonLinux2022ImageSsmParameterProps(
84803
+ kernel=kernel,
84804
+ cpu_type=cpu_type,
84805
+ edition=edition,
84806
+ cached_in_context=cached_in_context,
84807
+ user_data=user_data,
84808
+ )
84809
+
84810
+ jsii.create(self.__class__, self, [props])
84811
+
84812
+ @jsii.member(jsii_name="ssmParameterName")
84813
+ @builtins.classmethod
84814
+ def ssm_parameter_name(
84815
+ cls,
84816
+ *,
84817
+ kernel: typing.Optional[AmazonLinux2022Kernel] = None,
84818
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
84819
+ edition: typing.Optional[AmazonLinuxEdition] = None,
84820
+ cached_in_context: typing.Optional[builtins.bool] = None,
84821
+ user_data: typing.Optional[UserData] = None,
84822
+ ) -> builtins.str:
84823
+ '''Generates a SSM Parameter name for a specific amazon linux 2022 AMI.
84824
+
84825
+ Example values::
84826
+
84827
+ "/aws/service/ami-amazon-linux-latest/al2022-ami-kernel-5.15-x86_64",
84828
+ "/aws/service/ami-amazon-linux-latest/al2022-ami-kernel-default-x86_64",
84829
+ "/aws/service/ami-amazon-linux-latest/al2022-ami-minimal-kernel-5.15-arm64",
84830
+ "/aws/service/ami-amazon-linux-latest/al2022-ami-minimal-kernel-5.15-x86_64",
84831
+ "/aws/service/ami-amazon-linux-latest/al2022-ami-kernel-5.15-arm64",
84832
+ "/aws/service/ami-amazon-linux-latest/al2022-ami-minimal-kernel-default-arm64",
84833
+ "/aws/service/ami-amazon-linux-latest/al2022-ami-minimal-kernel-default-x86_64",
84834
+ "/aws/service/ami-amazon-linux-latest/al2022-ami-kernel-default-arm64",
84835
+
84836
+ :param kernel: What kernel version of Amazon Linux to use. Default: AmazonLinux2022Kernel.DEFAULT
84837
+ :param cpu_type: CPU Type. Default: AmazonLinuxCpuType.X86_64
84838
+ :param edition: What edition of Amazon Linux to use. Default: AmazonLinuxEdition.Standard
84839
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
84840
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
84841
+ '''
84842
+ props = AmazonLinux2022ImageSsmParameterProps(
84843
+ kernel=kernel,
84844
+ cpu_type=cpu_type,
84845
+ edition=edition,
84846
+ cached_in_context=cached_in_context,
84847
+ user_data=user_data,
84848
+ )
84849
+
84850
+ return typing.cast(builtins.str, jsii.sinvoke(cls, "ssmParameterName", [props]))
84851
+
84852
+
84853
+ class AmazonLinux2023ImageSsmParameter(
84854
+ AmazonLinuxImageSsmParameterBase,
84855
+ metaclass=jsii.JSIIMeta,
84856
+ jsii_type="aws-cdk-lib.aws_ec2.AmazonLinux2023ImageSsmParameter",
84857
+ ):
84858
+ '''A SSM Parameter that contains the AMI ID for Amazon Linux 2023.
84859
+
84860
+ :exampleMetadata: infused
84861
+
84862
+ Example::
84863
+
84864
+ # Example automatically generated from non-compiling source. May contain errors.
84865
+ ec2.Instance(self, "LatestAl2023",
84866
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
84867
+ machine_image=ec2.MachineImage.latest_amazon_linux2023(
84868
+ cached_in_context=True
84869
+ )
84870
+ )
84871
+
84872
+ # or
84873
+ ec2.Instance(self, "LatestAl2023",
84874
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
84875
+ # context cache is turned on by default
84876
+ machine_image=ec2.AmazonLinux2023ImageSsmParameter()
84877
+ )
84878
+ '''
84879
+
84880
+ def __init__(
84881
+ self,
84882
+ *,
84883
+ kernel: typing.Optional[AmazonLinux2023Kernel] = None,
84884
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
84885
+ edition: typing.Optional[AmazonLinuxEdition] = None,
84886
+ cached_in_context: typing.Optional[builtins.bool] = None,
84887
+ user_data: typing.Optional[UserData] = None,
84888
+ ) -> None:
84889
+ '''
84890
+ :param kernel: What kernel version of Amazon Linux to use. Default: AmazonLinux2023Kernel.DEFAULT
84891
+ :param cpu_type: CPU Type. Default: AmazonLinuxCpuType.X86_64
84892
+ :param edition: What edition of Amazon Linux to use. Default: AmazonLinuxEdition.Standard
84893
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
84894
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
84895
+ '''
84896
+ props = AmazonLinux2023ImageSsmParameterProps(
84897
+ kernel=kernel,
84898
+ cpu_type=cpu_type,
84899
+ edition=edition,
84900
+ cached_in_context=cached_in_context,
84901
+ user_data=user_data,
84902
+ )
84903
+
84904
+ jsii.create(self.__class__, self, [props])
84905
+
84906
+ @jsii.member(jsii_name="ssmParameterName")
84907
+ @builtins.classmethod
84908
+ def ssm_parameter_name(
84909
+ cls,
84910
+ *,
84911
+ kernel: typing.Optional[AmazonLinux2023Kernel] = None,
84912
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
84913
+ edition: typing.Optional[AmazonLinuxEdition] = None,
84914
+ cached_in_context: typing.Optional[builtins.bool] = None,
84915
+ user_data: typing.Optional[UserData] = None,
84916
+ ) -> builtins.str:
84917
+ '''Generates a SSM Parameter name for a specific amazon linux 2022 AMI.
84918
+
84919
+ Example values::
84920
+
84921
+ "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-arm64",
84922
+ "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64",
84923
+ "/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-6.1-arm64",
84924
+ "/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-6.1-x86_64",
84925
+ "/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-arm64",
84926
+ "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64",
84927
+ "/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64",
84928
+ "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-arm64",
84929
+
84930
+ :param kernel: What kernel version of Amazon Linux to use. Default: AmazonLinux2023Kernel.DEFAULT
84931
+ :param cpu_type: CPU Type. Default: AmazonLinuxCpuType.X86_64
84932
+ :param edition: What edition of Amazon Linux to use. Default: AmazonLinuxEdition.Standard
84933
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
84934
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
84935
+ '''
84936
+ props = AmazonLinux2023ImageSsmParameterProps(
84937
+ kernel=kernel,
84938
+ cpu_type=cpu_type,
84939
+ edition=edition,
84940
+ cached_in_context=cached_in_context,
84941
+ user_data=user_data,
84942
+ )
84943
+
84944
+ return typing.cast(builtins.str, jsii.sinvoke(cls, "ssmParameterName", [props]))
84945
+
84946
+
84947
+ class AmazonLinux2ImageSsmParameter(
84948
+ AmazonLinuxImageSsmParameterBase,
84949
+ metaclass=jsii.JSIIMeta,
84950
+ jsii_type="aws-cdk-lib.aws_ec2.AmazonLinux2ImageSsmParameter",
84951
+ ):
84952
+ '''A SSM Parameter that contains the AMI ID for Amazon Linux 2.
84953
+
84954
+ :exampleMetadata: fixture=_generated
84955
+
84956
+ Example::
84957
+
84958
+ # The code below shows an example of how to instantiate this type.
84959
+ # The values are placeholders you should change.
84960
+ from aws_cdk import aws_ec2 as ec2
84961
+
84962
+ # amazon_linux2_kernel: ec2.AmazonLinux2Kernel
84963
+ # user_data: ec2.UserData
84964
+
84965
+ amazon_linux2_image_ssm_parameter = ec2.AmazonLinux2ImageSsmParameter(
84966
+ cached_in_context=False,
84967
+ cpu_type=ec2.AmazonLinuxCpuType.ARM_64,
84968
+ edition=ec2.AmazonLinuxEdition.STANDARD,
84969
+ kernel=amazon_linux2_kernel,
84970
+ storage=ec2.AmazonLinuxStorage.EBS,
84971
+ user_data=user_data,
84972
+ virtualization=ec2.AmazonLinuxVirt.HVM
84973
+ )
84974
+ '''
84975
+
84976
+ def __init__(
84977
+ self,
84978
+ *,
84979
+ kernel: typing.Optional[AmazonLinux2Kernel] = None,
84980
+ storage: typing.Optional[AmazonLinuxStorage] = None,
84981
+ virtualization: typing.Optional[AmazonLinuxVirt] = None,
84982
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
84983
+ edition: typing.Optional[AmazonLinuxEdition] = None,
84984
+ cached_in_context: typing.Optional[builtins.bool] = None,
84985
+ user_data: typing.Optional[UserData] = None,
84986
+ ) -> None:
84987
+ '''
84988
+ :param kernel: What kernel version of Amazon Linux to use. Default: -
84989
+ :param storage: What storage backed image to use. Default: GeneralPurpose
84990
+ :param virtualization: Virtualization type. Default: HVM
84991
+ :param cpu_type: CPU Type. Default: AmazonLinuxCpuType.X86_64
84992
+ :param edition: What edition of Amazon Linux to use. Default: AmazonLinuxEdition.Standard
84993
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
84994
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
84995
+ '''
84996
+ props = AmazonLinux2ImageSsmParameterProps(
84997
+ kernel=kernel,
84998
+ storage=storage,
84999
+ virtualization=virtualization,
85000
+ cpu_type=cpu_type,
85001
+ edition=edition,
85002
+ cached_in_context=cached_in_context,
85003
+ user_data=user_data,
85004
+ )
85005
+
85006
+ jsii.create(self.__class__, self, [props])
85007
+
85008
+ @jsii.member(jsii_name="ssmParameterName")
85009
+ @builtins.classmethod
85010
+ def ssm_parameter_name(
85011
+ cls,
85012
+ *,
85013
+ kernel: typing.Optional[AmazonLinux2Kernel] = None,
85014
+ storage: typing.Optional[AmazonLinuxStorage] = None,
85015
+ virtualization: typing.Optional[AmazonLinuxVirt] = None,
85016
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
85017
+ edition: typing.Optional[AmazonLinuxEdition] = None,
85018
+ cached_in_context: typing.Optional[builtins.bool] = None,
85019
+ user_data: typing.Optional[UserData] = None,
85020
+ ) -> builtins.str:
85021
+ '''Generates a SSM Parameter name for a specific amazon linux 2 AMI.
85022
+
85023
+ Example values::
85024
+
85025
+ "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-ebs",
85026
+ "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2",
85027
+ "/aws/service/ami-amazon-linux-latest/amzn2-ami-kernel-5.10-hvm-x86_64-ebs",
85028
+ "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-arm64-gp2",
85029
+ "/aws/service/ami-amazon-linux-latest/amzn2-ami-minimal-hvm-arm64-ebs",
85030
+ "/aws/service/ami-amazon-linux-latest/amzn2-ami-kernel-5.10-hvm-arm64-gp2",
85031
+ "/aws/service/ami-amazon-linux-latest/amzn2-ami-kernel-5.10-hvm-x86_64-gp2",
85032
+ "/aws/service/ami-amazon-linux-latest/amzn2-ami-minimal-hvm-x86_64-ebs"
85033
+
85034
+ :param kernel: What kernel version of Amazon Linux to use. Default: -
85035
+ :param storage: What storage backed image to use. Default: GeneralPurpose
85036
+ :param virtualization: Virtualization type. Default: HVM
85037
+ :param cpu_type: CPU Type. Default: AmazonLinuxCpuType.X86_64
85038
+ :param edition: What edition of Amazon Linux to use. Default: AmazonLinuxEdition.Standard
85039
+ :param cached_in_context: Whether the AMI ID is cached to be stable between deployments. By default, the newest image is used on each deployment. This will cause instances to be replaced whenever a new version is released, and may cause downtime if there aren't enough running instances in the AutoScalingGroup to reschedule the tasks on. If set to true, the AMI ID will be cached in ``cdk.context.json`` and the same value will be used on future runs. Your instances will not be replaced but your AMI version will grow old over time. To refresh the AMI lookup, you will have to evict the value from the cache using the ``cdk context`` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Can not be set to ``true`` in environment-agnostic stacks. Default: false
85040
+ :param user_data: Initial user data. Default: - Empty UserData for Linux machines
85041
+ '''
85042
+ props = AmazonLinux2ImageSsmParameterProps(
85043
+ kernel=kernel,
85044
+ storage=storage,
85045
+ virtualization=virtualization,
85046
+ cpu_type=cpu_type,
85047
+ edition=edition,
85048
+ cached_in_context=cached_in_context,
85049
+ user_data=user_data,
85050
+ )
85051
+
85052
+ return typing.cast(builtins.str, jsii.sinvoke(cls, "ssmParameterName", [props]))
85053
+
85054
+
83729
85055
  class AmazonLinuxImage(
83730
85056
  GenericSSMParameterImage,
83731
85057
  metaclass=jsii.JSIIMeta,
@@ -84183,11 +85509,24 @@ __all__ = [
84183
85509
  "AddRouteOptions",
84184
85510
  "AllocateCidrRequest",
84185
85511
  "AllocatedSubnet",
85512
+ "AmazonLinux2022ImageSsmParameter",
85513
+ "AmazonLinux2022ImageSsmParameterProps",
85514
+ "AmazonLinux2022Kernel",
85515
+ "AmazonLinux2023ImageSsmParameter",
85516
+ "AmazonLinux2023ImageSsmParameterProps",
85517
+ "AmazonLinux2023Kernel",
85518
+ "AmazonLinux2ImageSsmParameter",
85519
+ "AmazonLinux2ImageSsmParameterProps",
85520
+ "AmazonLinux2Kernel",
84186
85521
  "AmazonLinuxCpuType",
84187
85522
  "AmazonLinuxEdition",
84188
85523
  "AmazonLinuxGeneration",
84189
85524
  "AmazonLinuxImage",
84190
85525
  "AmazonLinuxImageProps",
85526
+ "AmazonLinuxImageSsmParameterBase",
85527
+ "AmazonLinuxImageSsmParameterBaseOptions",
85528
+ "AmazonLinuxImageSsmParameterBaseProps",
85529
+ "AmazonLinuxImageSsmParameterCommonOptions",
84191
85530
  "AmazonLinuxKernel",
84192
85531
  "AmazonLinuxStorage",
84193
85532
  "AmazonLinuxVirt",
@@ -84684,6 +86023,24 @@ def _typecheckingstub__cca8efe6fa73141fbec2a2cf91f8f6bf2e0f69d49252bd2d45b21fcb2
84684
86023
  """Type checking stubs"""
84685
86024
  pass
84686
86025
 
86026
+ def _typecheckingstub__67731f51c6dad8d404e1a6ed177e5a2605da4ce360058d786cf253f72d1aee3d(
86027
+ version: builtins.str,
86028
+ ) -> None:
86029
+ """Type checking stubs"""
86030
+ pass
86031
+
86032
+ def _typecheckingstub__0ab727190b8ad0e28c2d1ddc702af61630c845ff5aedd9578b75429a06aba8f5(
86033
+ version: builtins.str,
86034
+ ) -> None:
86035
+ """Type checking stubs"""
86036
+ pass
86037
+
86038
+ def _typecheckingstub__3d9d80aebc17990a8f3419f9444ec1fdd3e5bc1c150c3db0d42eda409806c7a8(
86039
+ version: builtins.str,
86040
+ ) -> None:
86041
+ """Type checking stubs"""
86042
+ pass
86043
+
84687
86044
  def _typecheckingstub__dd95a518c06563a07debc9bf1ca51713b747cf64bded6f7cc81a28680d7ea9fc(
84688
86045
  *,
84689
86046
  cached_in_context: typing.Optional[builtins.bool] = None,
@@ -84698,6 +86055,33 @@ def _typecheckingstub__dd95a518c06563a07debc9bf1ca51713b747cf64bded6f7cc81a28680
84698
86055
  """Type checking stubs"""
84699
86056
  pass
84700
86057
 
86058
+ def _typecheckingstub__08eb71b09afb1d361b3f043a5c2d7d4be91f84b114302afefc8a69963ee6333f(
86059
+ *,
86060
+ cached_in_context: typing.Optional[builtins.bool] = None,
86061
+ user_data: typing.Optional[UserData] = None,
86062
+ ) -> None:
86063
+ """Type checking stubs"""
86064
+ pass
86065
+
86066
+ def _typecheckingstub__78a32cfc14171e780d6e44d3e6a99faa6da50655ac09560f7b229b0c0c7383f1(
86067
+ *,
86068
+ cached_in_context: typing.Optional[builtins.bool] = None,
86069
+ user_data: typing.Optional[UserData] = None,
86070
+ parameter_name: builtins.str,
86071
+ ) -> None:
86072
+ """Type checking stubs"""
86073
+ pass
86074
+
86075
+ def _typecheckingstub__8fcdd01a6ab45c77447fba339b5a9358c3ab40c4833c1f86c68009a6a3bb1422(
86076
+ *,
86077
+ cached_in_context: typing.Optional[builtins.bool] = None,
86078
+ user_data: typing.Optional[UserData] = None,
86079
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
86080
+ edition: typing.Optional[AmazonLinuxEdition] = None,
86081
+ ) -> None:
86082
+ """Type checking stubs"""
86083
+ pass
86084
+
84701
86085
  def _typecheckingstub__e7f632381407c0e83d84ca5b16928a38d4d8f6de29513094b92a876e870ddb63(
84702
86086
  *,
84703
86087
  config_sets: typing.Optional[typing.Sequence[builtins.str]] = None,
@@ -94637,6 +96021,47 @@ def _typecheckingstub__a9243d0fea7f4d4e8b65c37925a1dbb71b6136866e6c28c37f9d5dc79
94637
96021
  """Type checking stubs"""
94638
96022
  pass
94639
96023
 
96024
+ def _typecheckingstub__968329b6e3d88dbd1836e6234bc305a96628c570666cc423d4eeccc95dc92ab6(
96025
+ *,
96026
+ cached_in_context: typing.Optional[builtins.bool] = None,
96027
+ user_data: typing.Optional[UserData] = None,
96028
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
96029
+ edition: typing.Optional[AmazonLinuxEdition] = None,
96030
+ kernel: typing.Optional[AmazonLinux2022Kernel] = None,
96031
+ ) -> None:
96032
+ """Type checking stubs"""
96033
+ pass
96034
+
96035
+ def _typecheckingstub__d2a291560388da3a1deca6cc63773b445813e32521bbcf4ece1d3a557e2eda6b(
96036
+ *,
96037
+ cached_in_context: typing.Optional[builtins.bool] = None,
96038
+ user_data: typing.Optional[UserData] = None,
96039
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
96040
+ edition: typing.Optional[AmazonLinuxEdition] = None,
96041
+ kernel: typing.Optional[AmazonLinux2023Kernel] = None,
96042
+ ) -> None:
96043
+ """Type checking stubs"""
96044
+ pass
96045
+
96046
+ def _typecheckingstub__8aa3dd8e9489482da5f68eebe827af2a2367490c7299028616bae30c26efbd55(
96047
+ *,
96048
+ cached_in_context: typing.Optional[builtins.bool] = None,
96049
+ user_data: typing.Optional[UserData] = None,
96050
+ cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
96051
+ edition: typing.Optional[AmazonLinuxEdition] = None,
96052
+ kernel: typing.Optional[AmazonLinux2Kernel] = None,
96053
+ storage: typing.Optional[AmazonLinuxStorage] = None,
96054
+ virtualization: typing.Optional[AmazonLinuxVirt] = None,
96055
+ ) -> None:
96056
+ """Type checking stubs"""
96057
+ pass
96058
+
96059
+ def _typecheckingstub__cf74508a9d2ec0bb2e7646472ba3fe700482482a3d87536fb58694a37fa01191(
96060
+ scope: _constructs_77d1e7e8.Construct,
96061
+ ) -> None:
96062
+ """Type checking stubs"""
96063
+ pass
96064
+
94640
96065
  def _typecheckingstub__92a5b88f3339020054ea1e16e9617c17798da0b874294e4200a9b8e5bf598a4b(
94641
96066
  scope: _constructs_77d1e7e8.Construct,
94642
96067
  id: builtins.str,