aws-cdk-lib 2.209.1__py3-none-any.whl → 2.211.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 (58) hide show
  1. aws_cdk/__init__.py +6 -11
  2. aws_cdk/_jsii/__init__.py +1 -1
  3. aws_cdk/_jsii/{aws-cdk-lib@2.209.1.jsii.tgz → aws-cdk-lib@2.211.0.jsii.tgz} +0 -0
  4. aws_cdk/aws_amazonmq/__init__.py +2 -1
  5. aws_cdk/aws_appconfig/__init__.py +9 -0
  6. aws_cdk/aws_arcregionswitch/__init__.py +4962 -0
  7. aws_cdk/aws_athena/__init__.py +23 -19
  8. aws_cdk/aws_autoscaling/__init__.py +6 -6
  9. aws_cdk/aws_batch/__init__.py +721 -51
  10. aws_cdk/aws_cassandra/__init__.py +28 -1
  11. aws_cdk/aws_cloudfront/__init__.py +20 -8
  12. aws_cdk/aws_cognito/__init__.py +9 -2
  13. aws_cdk/aws_datazone/__init__.py +118 -77
  14. aws_cdk/aws_dax/__init__.py +39 -0
  15. aws_cdk/aws_deadline/__init__.py +155 -7
  16. aws_cdk/aws_docdb/__init__.py +20 -11
  17. aws_cdk/aws_dynamodb/__init__.py +160 -20
  18. aws_cdk/aws_ec2/__init__.py +978 -256
  19. aws_cdk/aws_ecr/__init__.py +274 -0
  20. aws_cdk/aws_ecs/__init__.py +335 -220
  21. aws_cdk/aws_eks/__init__.py +51 -3
  22. aws_cdk/aws_elasticloadbalancingv2/__init__.py +9 -7
  23. aws_cdk/aws_entityresolution/__init__.py +240 -45
  24. aws_cdk/aws_evs/__init__.py +20 -45
  25. aws_cdk/aws_iot/__init__.py +387 -0
  26. aws_cdk/aws_iotsitewise/__init__.py +1247 -139
  27. aws_cdk/aws_ivs/__init__.py +443 -33
  28. aws_cdk/aws_kinesisfirehose/__init__.py +2 -0
  29. aws_cdk/aws_kms/__init__.py +15 -0
  30. aws_cdk/aws_lambda/__init__.py +3 -3
  31. aws_cdk/aws_lightsail/__init__.py +590 -0
  32. aws_cdk/aws_logs/__init__.py +97 -3
  33. aws_cdk/aws_medialive/__init__.py +270 -7
  34. aws_cdk/aws_mediapackagev2/__init__.py +204 -6
  35. aws_cdk/aws_neptune/__init__.py +41 -2
  36. aws_cdk/aws_networkfirewall/__init__.py +490 -134
  37. aws_cdk/aws_observabilityadmin/__init__.py +1468 -0
  38. aws_cdk/aws_opensearchserverless/__init__.py +2 -2
  39. aws_cdk/aws_opsworks/__init__.py +125 -125
  40. aws_cdk/aws_opsworkscm/__init__.py +1 -53
  41. aws_cdk/aws_pcs/__init__.py +36 -0
  42. aws_cdk/aws_qbusiness/__init__.py +3 -3
  43. aws_cdk/aws_quicksight/__init__.py +107 -0
  44. aws_cdk/aws_rds/__init__.py +274 -0
  45. aws_cdk/aws_s3/__init__.py +56 -1
  46. aws_cdk/aws_s3express/__init__.py +52 -1
  47. aws_cdk/aws_sagemaker/__init__.py +4033 -218
  48. aws_cdk/aws_ses/__init__.py +172 -9
  49. aws_cdk/aws_ssm/__init__.py +8 -4
  50. aws_cdk/aws_verifiedpermissions/__init__.py +23 -2
  51. aws_cdk/aws_wisdom/__init__.py +2 -2
  52. aws_cdk/aws_workspacesweb/__init__.py +949 -157
  53. {aws_cdk_lib-2.209.1.dist-info → aws_cdk_lib-2.211.0.dist-info}/METADATA +8 -8
  54. {aws_cdk_lib-2.209.1.dist-info → aws_cdk_lib-2.211.0.dist-info}/RECORD +58 -56
  55. {aws_cdk_lib-2.209.1.dist-info → aws_cdk_lib-2.211.0.dist-info}/LICENSE +0 -0
  56. {aws_cdk_lib-2.209.1.dist-info → aws_cdk_lib-2.211.0.dist-info}/NOTICE +0 -0
  57. {aws_cdk_lib-2.209.1.dist-info → aws_cdk_lib-2.211.0.dist-info}/WHEEL +0 -0
  58. {aws_cdk_lib-2.209.1.dist-info → aws_cdk_lib-2.211.0.dist-info}/top_level.txt +0 -0
@@ -2118,8 +2118,6 @@ Amazon ECS supports native blue/green deployments that allow you to deploy new v
2118
2118
 
2119
2119
  [Amazon ECS blue/green deployments](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-blue-green.html)
2120
2120
 
2121
- ### Using Fargate L2 constructs for Blue/Green Feature
2122
-
2123
2121
  ```python
2124
2122
  import aws_cdk.aws_lambda as lambda_
2125
2123
 
@@ -2141,99 +2139,17 @@ service.add_lifecycle_hook(ecs.DeploymentLifecycleLambdaTarget(lambda_hook, "Pre
2141
2139
  lifecycle_stages=[ecs.DeploymentLifecycleStage.PRE_SCALE_UP]
2142
2140
  ))
2143
2141
 
2144
- target = service.load_balancer_target(ecs.LoadBalancerTargetOptions(
2142
+ target = service.load_balancer_target(
2145
2143
  container_name="nginx",
2146
2144
  container_port=80,
2147
- protocol=ecs.Protocol.TCP
2148
- ), ecs.AlternateTarget("AlternateTarget",
2149
- alternate_target_group=green_target_group,
2150
- production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
2151
- ))
2152
-
2153
- target.attach_to_application_target_group(blue_target_group)
2154
- ```
2155
-
2156
- ### Using Escape Hatches for Blue/Green Features
2157
-
2158
- The new blue/green deployment features are added to CloudFormation but not yet available in the CDK L2 constructs, you can use escape hatches to access them through the L1 (CfnService) construct.
2159
-
2160
- #### Load Balancer Advanced Configuration
2161
-
2162
- Configure advanced load balancer settings for blue/green deployments with alternate target groups and listener rules:
2163
-
2164
- ```python
2165
- # service: ecs.FargateService
2166
-
2167
-
2168
- cfn_service = service.node.default_child
2169
- cfn_service.load_balancers = [ecs.CfnService.LoadBalancerProperty(
2170
- container_name="web",
2171
- container_port=80,
2172
- target_group_arn="arn:aws:elasticloadbalancing:region:account:targetgroup/production",
2173
- advanced_configuration=ecs.CfnService.AdvancedConfigurationProperty(
2174
- alternate_target_group_arn="arn:aws:elasticloadbalancing:region:account:targetgroup/test",
2175
- production_listener_rule="arn:aws:elasticloadbalancing:region:account:listener-rule/production-rule",
2176
- test_listener_rule="arn:aws:elasticloadbalancing:region:account:listener-rule/test-rule",
2177
- role_arn="arn:aws:iam::account:role/ecs-blue-green-role"
2145
+ protocol=ecs.Protocol.TCP,
2146
+ alternate_target=ecs.AlternateTarget("AlternateTarget",
2147
+ alternate_target_group=green_target_group,
2148
+ production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
2178
2149
  )
2179
- )]
2180
- ```
2181
-
2182
- #### Blue/Green Deployment Configuration
2183
-
2184
- Configure deployment strategy with bake time and lifecycle hooks:
2185
-
2186
- ```python
2187
- # service: ecs.FargateService
2188
-
2189
-
2190
- cfn_service = service.node.default_child
2191
- cfn_service.deployment_configuration = ecs.CfnService.DeploymentConfigurationProperty(
2192
- maximum_percent=200,
2193
- minimum_healthy_percent=100,
2194
- strategy="BLUE_GREEN",
2195
- bake_time_in_minutes=15,
2196
- lifecycle_hooks=[ecs.CfnService.DeploymentLifecycleHookProperty(
2197
- hook_target_arn="arn:aws:lambda:region:account:function:pre-deployment-hook",
2198
- role_arn="arn:aws:iam::account:role/deployment-hook-role",
2199
- lifecycle_stages=["PRE_STOP", "POST_START"]
2200
- )]
2201
2150
  )
2202
- ```
2203
-
2204
- #### Service Connect Test Traffic Rules
2205
-
2206
- Configure test traffic routing for Service Connect during blue/green deployments:
2207
-
2208
- ```python
2209
- # cluster: ecs.Cluster
2210
- # task_definition: ecs.TaskDefinition
2211
2151
 
2212
-
2213
- service = ecs.FargateService(self, "Service",
2214
- cluster=cluster,
2215
- task_definition=task_definition
2216
- )
2217
-
2218
- cfn_service = service.node.default_child
2219
- cfn_service.service_connect_configuration = ecs.CfnService.ServiceConnectConfigurationProperty(
2220
- enabled=True,
2221
- services=[ecs.CfnService.ServiceConnectServiceProperty(
2222
- port_name="api",
2223
- client_aliases=[ecs.CfnService.ServiceConnectClientAliasProperty(
2224
- port=80,
2225
- dns_name="my-service",
2226
- test_traffic_rules=ecs.CfnService.ServiceConnectTestTrafficRulesProperty(
2227
- header=ecs.CfnService.ServiceConnectTestTrafficRulesHeaderProperty(
2228
- name="x-canary-test",
2229
- value=ecs.CfnService.ServiceConnectTestTrafficRulesHeaderValueProperty(
2230
- exact="beta-version"
2231
- )
2232
- )
2233
- )
2234
- )]
2235
- )]
2236
- )
2152
+ target.attach_to_application_target_group(blue_target_group)
2237
2153
  ```
2238
2154
 
2239
2155
  ## Daemon Scheduling Strategy
@@ -2643,7 +2559,7 @@ class AddCapacityOptions(
2643
2559
  :param key_name: (deprecated) Name of SSH keypair to grant access to instances. ``launchTemplate`` and ``mixedInstancesPolicy`` must not be specified when this property is specified You can either specify ``keyPair`` or ``keyName``, not both. Default: - No SSH access will be possible.
2644
2560
  :param key_pair: The SSH keypair to grant access to the instance. Feature flag ``AUTOSCALING_GENERATE_LAUNCH_TEMPLATE`` must be enabled to use this property. ``launchTemplate`` and ``mixedInstancesPolicy`` must not be specified when this property is specified. You can either specify ``keyPair`` or ``keyName``, not both. Default: - No SSH access will be possible.
2645
2561
  :param max_capacity: Maximum number of instances in the fleet. Default: desiredCapacity
2646
- :param max_instance_lifetime: The maximum amount of time that an instance can be in service. The maximum duration applies to all current and future instances in the group. As an instance approaches its maximum duration, it is terminated and replaced, and cannot be used again. You must specify a value of at least 604,800 seconds (7 days). To clear a previously set value, leave this property undefined. Default: none
2562
+ :param max_instance_lifetime: The maximum amount of time that an instance can be in service. The maximum duration applies to all current and future instances in the group. As an instance approaches its maximum duration, it is terminated and replaced, and cannot be used again. You must specify a value of at least 86,400 seconds (one day). To clear a previously set value, leave this property undefined. Default: none
2647
2563
  :param min_capacity: Minimum number of instances in the fleet. Default: 1
2648
2564
  :param new_instances_protected_from_scale_in: Whether newly-launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in. By default, Auto Scaling can terminate an instance at any time after launch when scaling in an Auto Scaling Group, subject to the group's termination policy. However, you may wish to protect newly-launched instances from being scaled in if they are going to run critical applications that should not be prematurely terminated. This flag must be enabled if the Auto Scaling Group will be associated with an ECS Capacity Provider with managed termination protection. Default: false
2649
2565
  :param notifications: Configure autoscaling group to send notifications about fleet changes to an SNS topic(s). Default: - No fleet change notifications will be sent.
@@ -3065,7 +2981,7 @@ class AddCapacityOptions(
3065
2981
  to all current and future instances in the group. As an instance approaches its maximum duration,
3066
2982
  it is terminated and replaced, and cannot be used again.
3067
2983
 
3068
- You must specify a value of at least 604,800 seconds (7 days). To clear a previously set value,
2984
+ You must specify a value of at least 86,400 seconds (one day). To clear a previously set value,
3069
2985
  leave this property undefined.
3070
2986
 
3071
2987
  :default: none
@@ -3553,14 +3469,15 @@ class AlternateTargetProps(AlternateTargetOptions):
3553
3469
  lifecycle_stages=[ecs.DeploymentLifecycleStage.PRE_SCALE_UP]
3554
3470
  ))
3555
3471
 
3556
- target = service.load_balancer_target(ecs.LoadBalancerTargetOptions(
3472
+ target = service.load_balancer_target(
3557
3473
  container_name="nginx",
3558
3474
  container_port=80,
3559
- protocol=ecs.Protocol.TCP
3560
- ), ecs.AlternateTarget("AlternateTarget",
3561
- alternate_target_group=green_target_group,
3562
- production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
3563
- ))
3475
+ protocol=ecs.Protocol.TCP,
3476
+ alternate_target=ecs.AlternateTarget("AlternateTarget",
3477
+ alternate_target_group=green_target_group,
3478
+ production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
3479
+ )
3480
+ )
3564
3481
 
3565
3482
  target.attach_to_application_target_group(blue_target_group)
3566
3483
  '''
@@ -9081,23 +8998,184 @@ class CfnService(
9081
8998
 
9082
8999
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
9083
9000
  :cloudformationResource: AWS::ECS::Service
9084
- :exampleMetadata: infused
9001
+ :exampleMetadata: fixture=_generated
9085
9002
 
9086
9003
  Example::
9087
9004
 
9088
- # service: ecs.FargateService
9005
+ # The code below shows an example of how to instantiate this type.
9006
+ # The values are placeholders you should change.
9007
+ from aws_cdk import aws_ecs as ecs
9008
+
9009
+ cfn_service = ecs.CfnService(self, "MyCfnService",
9010
+ availability_zone_rebalancing="availabilityZoneRebalancing",
9011
+ capacity_provider_strategy=[ecs.CfnService.CapacityProviderStrategyItemProperty(
9012
+ base=123,
9013
+ capacity_provider="capacityProvider",
9014
+ weight=123
9015
+ )],
9016
+ cluster="cluster",
9017
+ deployment_configuration=ecs.CfnService.DeploymentConfigurationProperty(
9018
+ alarms=ecs.CfnService.DeploymentAlarmsProperty(
9019
+ alarm_names=["alarmNames"],
9020
+ enable=False,
9021
+ rollback=False
9022
+ ),
9023
+ bake_time_in_minutes=123,
9024
+ deployment_circuit_breaker=ecs.CfnService.DeploymentCircuitBreakerProperty(
9025
+ enable=False,
9026
+ rollback=False
9027
+ ),
9028
+ lifecycle_hooks=[ecs.CfnService.DeploymentLifecycleHookProperty(
9029
+ hook_target_arn="hookTargetArn",
9030
+ lifecycle_stages=["lifecycleStages"],
9031
+ role_arn="roleArn"
9032
+ )],
9033
+ maximum_percent=123,
9034
+ minimum_healthy_percent=123,
9035
+ strategy="strategy"
9036
+ ),
9037
+ deployment_controller=ecs.CfnService.DeploymentControllerProperty(
9038
+ type="type"
9039
+ ),
9040
+ desired_count=123,
9041
+ enable_ecs_managed_tags=False,
9042
+ enable_execute_command=False,
9043
+ health_check_grace_period_seconds=123,
9044
+ launch_type="launchType",
9045
+ load_balancers=[ecs.CfnService.LoadBalancerProperty(
9046
+ advanced_configuration=ecs.CfnService.AdvancedConfigurationProperty(
9047
+ alternate_target_group_arn="alternateTargetGroupArn",
9048
+
9049
+ # the properties below are optional
9050
+ production_listener_rule="productionListenerRule",
9051
+ role_arn="roleArn",
9052
+ test_listener_rule="testListenerRule"
9053
+ ),
9054
+ container_name="containerName",
9055
+ container_port=123,
9056
+ load_balancer_name="loadBalancerName",
9057
+ target_group_arn="targetGroupArn"
9058
+ )],
9059
+ network_configuration=ecs.CfnService.NetworkConfigurationProperty(
9060
+ awsvpc_configuration=ecs.CfnService.AwsVpcConfigurationProperty(
9061
+ assign_public_ip="assignPublicIp",
9062
+ security_groups=["securityGroups"],
9063
+ subnets=["subnets"]
9064
+ )
9065
+ ),
9066
+ placement_constraints=[ecs.CfnService.PlacementConstraintProperty(
9067
+ type="type",
9068
+
9069
+ # the properties below are optional
9070
+ expression="expression"
9071
+ )],
9072
+ placement_strategies=[ecs.CfnService.PlacementStrategyProperty(
9073
+ type="type",
9074
+
9075
+ # the properties below are optional
9076
+ field="field"
9077
+ )],
9078
+ platform_version="platformVersion",
9079
+ propagate_tags="propagateTags",
9080
+ role="role",
9081
+ scheduling_strategy="schedulingStrategy",
9082
+ service_connect_configuration=ecs.CfnService.ServiceConnectConfigurationProperty(
9083
+ enabled=False,
9084
+
9085
+ # the properties below are optional
9086
+ log_configuration=ecs.CfnService.LogConfigurationProperty(
9087
+ log_driver="logDriver",
9088
+ options={
9089
+ "options_key": "options"
9090
+ },
9091
+ secret_options=[ecs.CfnService.SecretProperty(
9092
+ name="name",
9093
+ value_from="valueFrom"
9094
+ )]
9095
+ ),
9096
+ namespace="namespace",
9097
+ services=[ecs.CfnService.ServiceConnectServiceProperty(
9098
+ port_name="portName",
9099
+
9100
+ # the properties below are optional
9101
+ client_aliases=[ecs.CfnService.ServiceConnectClientAliasProperty(
9102
+ port=123,
9089
9103
 
9104
+ # the properties below are optional
9105
+ dns_name="dnsName",
9106
+ test_traffic_rules=ecs.CfnService.ServiceConnectTestTrafficRulesProperty(
9107
+ header=ecs.CfnService.ServiceConnectTestTrafficRulesHeaderProperty(
9108
+ name="name",
9109
+
9110
+ # the properties below are optional
9111
+ value=ecs.CfnService.ServiceConnectTestTrafficRulesHeaderValueProperty(
9112
+ exact="exact"
9113
+ )
9114
+ )
9115
+ )
9116
+ )],
9117
+ discovery_name="discoveryName",
9118
+ ingress_port_override=123,
9119
+ timeout=ecs.CfnService.TimeoutConfigurationProperty(
9120
+ idle_timeout_seconds=123,
9121
+ per_request_timeout_seconds=123
9122
+ ),
9123
+ tls=ecs.CfnService.ServiceConnectTlsConfigurationProperty(
9124
+ issuer_certificate_authority=ecs.CfnService.ServiceConnectTlsCertificateAuthorityProperty(
9125
+ aws_pca_authority_arn="awsPcaAuthorityArn"
9126
+ ),
9090
9127
 
9091
- cfn_service = service.node.default_child
9092
- cfn_service.deployment_configuration = ecs.CfnService.DeploymentConfigurationProperty(
9093
- maximum_percent=200,
9094
- minimum_healthy_percent=100,
9095
- strategy="BLUE_GREEN",
9096
- bake_time_in_minutes=15,
9097
- lifecycle_hooks=[ecs.CfnService.DeploymentLifecycleHookProperty(
9098
- hook_target_arn="arn:aws:lambda:region:account:function:pre-deployment-hook",
9099
- role_arn="arn:aws:iam::account:role/deployment-hook-role",
9100
- lifecycle_stages=["PRE_STOP", "POST_START"]
9128
+ # the properties below are optional
9129
+ kms_key="kmsKey",
9130
+ role_arn="roleArn"
9131
+ )
9132
+ )]
9133
+ ),
9134
+ service_name="serviceName",
9135
+ service_registries=[ecs.CfnService.ServiceRegistryProperty(
9136
+ container_name="containerName",
9137
+ container_port=123,
9138
+ port=123,
9139
+ registry_arn="registryArn"
9140
+ )],
9141
+ tags=[CfnTag(
9142
+ key="key",
9143
+ value="value"
9144
+ )],
9145
+ task_definition="taskDefinition",
9146
+ volume_configurations=[ecs.CfnService.ServiceVolumeConfigurationProperty(
9147
+ name="name",
9148
+
9149
+ # the properties below are optional
9150
+ managed_ebs_volume=ecs.CfnService.ServiceManagedEBSVolumeConfigurationProperty(
9151
+ role_arn="roleArn",
9152
+
9153
+ # the properties below are optional
9154
+ encrypted=False,
9155
+ filesystem_type="filesystemType",
9156
+ iops=123,
9157
+ kms_key_id="kmsKeyId",
9158
+ size_in_gi_b=123,
9159
+ snapshot_id="snapshotId",
9160
+ tag_specifications=[ecs.CfnService.EBSTagSpecificationProperty(
9161
+ resource_type="resourceType",
9162
+
9163
+ # the properties below are optional
9164
+ propagate_tags="propagateTags",
9165
+ tags=[CfnTag(
9166
+ key="key",
9167
+ value="value"
9168
+ )]
9169
+ )],
9170
+ throughput=123,
9171
+ volume_initialization_rate=123,
9172
+ volume_type="volumeType"
9173
+ )
9174
+ )],
9175
+ vpc_lattice_configurations=[ecs.CfnService.VpcLatticeConfigurationProperty(
9176
+ port_name="portName",
9177
+ role_arn="roleArn",
9178
+ target_group_arn="targetGroupArn"
9101
9179
  )]
9102
9180
  )
9103
9181
  '''
@@ -9136,7 +9214,7 @@ class CfnService(
9136
9214
  '''
9137
9215
  :param scope: Scope in which this resource is defined.
9138
9216
  :param id: Construct identifier for this resource (unique in its scope).
9139
- :param availability_zone_rebalancing: Indicates whether to use Availability Zone rebalancing for the service. For more information, see `Balancing an Amazon ECS service across Availability Zones <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-rebalancing.html>`_ in the **Amazon Elastic Container Service Developer Guide** . Default: - "DISABLED"
9217
+ :param availability_zone_rebalancing: Indicates whether to use Availability Zone rebalancing for the service. For more information, see `Balancing an Amazon ECS service across Availability Zones <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-rebalancing.html>`_ in the **Amazon Elastic Container Service Developer Guide** . Default: - "ENABLED"
9140
9218
  :param capacity_provider_strategy: The capacity provider strategy to use for the service. If a ``capacityProviderStrategy`` is specified, the ``launchType`` parameter must be omitted. If no ``capacityProviderStrategy`` or ``launchType`` is specified, the ``defaultCapacityProviderStrategy`` for the cluster is used. A capacity provider strategy can contain a maximum of 20 capacity providers. .. epigraph:: To remove this property from your service resource, specify an empty ``CapacityProviderStrategyItem`` array.
9141
9219
  :param cluster: The short name or full Amazon Resource Name (ARN) of the cluster that you run your service on. If you do not specify a cluster, the default cluster is assumed.
9142
9220
  :param deployment_configuration: Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.
@@ -12995,7 +13073,7 @@ class CfnServiceProps:
12995
13073
  ) -> None:
12996
13074
  '''Properties for defining a ``CfnService``.
12997
13075
 
12998
- :param availability_zone_rebalancing: Indicates whether to use Availability Zone rebalancing for the service. For more information, see `Balancing an Amazon ECS service across Availability Zones <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-rebalancing.html>`_ in the **Amazon Elastic Container Service Developer Guide** . Default: - "DISABLED"
13076
+ :param availability_zone_rebalancing: Indicates whether to use Availability Zone rebalancing for the service. For more information, see `Balancing an Amazon ECS service across Availability Zones <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-rebalancing.html>`_ in the **Amazon Elastic Container Service Developer Guide** . Default: - "ENABLED"
12999
13077
  :param capacity_provider_strategy: The capacity provider strategy to use for the service. If a ``capacityProviderStrategy`` is specified, the ``launchType`` parameter must be omitted. If no ``capacityProviderStrategy`` or ``launchType`` is specified, the ``defaultCapacityProviderStrategy`` for the cluster is used. A capacity provider strategy can contain a maximum of 20 capacity providers. .. epigraph:: To remove this property from your service resource, specify an empty ``CapacityProviderStrategyItem`` array.
13000
13078
  :param cluster: The short name or full Amazon Resource Name (ARN) of the cluster that you run your service on. If you do not specify a cluster, the default cluster is assumed.
13001
13079
  :param deployment_configuration: Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.
@@ -13288,7 +13366,7 @@ class CfnServiceProps:
13288
13366
 
13289
13367
  For more information, see `Balancing an Amazon ECS service across Availability Zones <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-rebalancing.html>`_ in the **Amazon Elastic Container Service Developer Guide** .
13290
13368
 
13291
- :default: - "DISABLED"
13369
+ :default: - "ENABLED"
13292
13370
 
13293
13371
  :see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-availabilityzonerebalancing
13294
13372
  '''
@@ -24990,14 +25068,15 @@ class DeploymentLifecycleLambdaTargetProps:
24990
25068
  lifecycle_stages=[ecs.DeploymentLifecycleStage.PRE_SCALE_UP]
24991
25069
  ))
24992
25070
 
24993
- target = service.load_balancer_target(ecs.LoadBalancerTargetOptions(
25071
+ target = service.load_balancer_target(
24994
25072
  container_name="nginx",
24995
25073
  container_port=80,
24996
- protocol=ecs.Protocol.TCP
24997
- ), ecs.AlternateTarget("AlternateTarget",
24998
- alternate_target_group=green_target_group,
24999
- production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
25000
- ))
25074
+ protocol=ecs.Protocol.TCP,
25075
+ alternate_target=ecs.AlternateTarget("AlternateTarget",
25076
+ alternate_target_group=green_target_group,
25077
+ production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
25078
+ )
25079
+ )
25001
25080
 
25002
25081
  target.attach_to_application_target_group(blue_target_group)
25003
25082
  '''
@@ -25067,14 +25146,15 @@ class DeploymentLifecycleStage(enum.Enum):
25067
25146
  lifecycle_stages=[ecs.DeploymentLifecycleStage.PRE_SCALE_UP]
25068
25147
  ))
25069
25148
 
25070
- target = service.load_balancer_target(ecs.LoadBalancerTargetOptions(
25149
+ target = service.load_balancer_target(
25071
25150
  container_name="nginx",
25072
25151
  container_port=80,
25073
- protocol=ecs.Protocol.TCP
25074
- ), ecs.AlternateTarget("AlternateTarget",
25075
- alternate_target_group=green_target_group,
25076
- production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
25077
- ))
25152
+ protocol=ecs.Protocol.TCP,
25153
+ alternate_target=ecs.AlternateTarget("AlternateTarget",
25154
+ alternate_target_group=green_target_group,
25155
+ production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
25156
+ )
25157
+ )
25078
25158
 
25079
25159
  target.attach_to_application_target_group(blue_target_group)
25080
25160
  '''
@@ -25123,14 +25203,15 @@ class DeploymentStrategy(enum.Enum):
25123
25203
  lifecycle_stages=[ecs.DeploymentLifecycleStage.PRE_SCALE_UP]
25124
25204
  ))
25125
25205
 
25126
- target = service.load_balancer_target(ecs.LoadBalancerTargetOptions(
25206
+ target = service.load_balancer_target(
25127
25207
  container_name="nginx",
25128
25208
  container_port=80,
25129
- protocol=ecs.Protocol.TCP
25130
- ), ecs.AlternateTarget("AlternateTarget",
25131
- alternate_target_group=green_target_group,
25132
- production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
25133
- ))
25209
+ protocol=ecs.Protocol.TCP,
25210
+ alternate_target=ecs.AlternateTarget("AlternateTarget",
25211
+ alternate_target_group=green_target_group,
25212
+ production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
25213
+ )
25214
+ )
25134
25215
 
25135
25216
  target.attach_to_application_target_group(blue_target_group)
25136
25217
  '''
@@ -25829,7 +25910,7 @@ class Ec2ServiceProps(BaseServiceOptions):
25829
25910
  :param volume_configurations: Configuration details for a volume used by the service. This allows you to specify details about the EBS volume that can be attched to ECS tasks. Default: - undefined
25830
25911
  :param task_definition: The task definition to use for tasks in the service. [disable-awslint:ref-via-interface]
25831
25912
  :param assign_public_ip: Specifies whether the task's elastic network interface receives a public IP address. If true, each task will receive a public IP address. This property is only used for tasks that use the awsvpc network mode. Default: false
25832
- :param availability_zone_rebalancing: Whether to use Availability Zone rebalancing for the service. If enabled: ``maxHealthyPercent`` must be greater than 100; ``daemon`` must be false; if there are any ``placementStrategies``, the first must be "spread across Availability Zones"; there must be no ``placementConstraints`` using ``attribute:ecs.availability-zone``, and the service must not be a target of a Classic Load Balancer. Default: AvailabilityZoneRebalancing.DISABLED
25913
+ :param availability_zone_rebalancing: Whether to use Availability Zone rebalancing for the service. If enabled: ``maxHealthyPercent`` must be greater than 100; ``daemon`` must be false; if there are any ``placementStrategies``, the first must be "spread across Availability Zones"; there must be no ``placementConstraints`` using ``attribute:ecs.availability-zone``, and the service must not be a target of a Classic Load Balancer. Default: AvailabilityZoneRebalancing.ENABLED
25833
25914
  :param daemon: Specifies whether the service will use the daemon scheduling strategy. If true, the service scheduler deploys exactly one task on each container instance in your cluster. When you are using this strategy, do not specify a desired number of tasks or any task placement strategies. Default: false
25834
25915
  :param placement_constraints: The placement constraints to use for tasks in the service. For more information, see `Amazon ECS Task Placement Constraints <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html>`_. Default: - No constraints.
25835
25916
  :param placement_strategies: The placement strategies to use for tasks in the service. For more information, see `Amazon ECS Task Placement Strategies <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html>`_. Default: - No strategies.
@@ -26203,7 +26284,7 @@ class Ec2ServiceProps(BaseServiceOptions):
26203
26284
  must be no ``placementConstraints`` using ``attribute:ecs.availability-zone``, and the
26204
26285
  service must not be a target of a Classic Load Balancer.
26205
26286
 
26206
- :default: AvailabilityZoneRebalancing.DISABLED
26287
+ :default: AvailabilityZoneRebalancing.ENABLED
26207
26288
 
26208
26289
  :see: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-rebalancing.html
26209
26290
  '''
@@ -28784,7 +28865,7 @@ class FargateServiceProps(BaseServiceOptions):
28784
28865
  :param volume_configurations: Configuration details for a volume used by the service. This allows you to specify details about the EBS volume that can be attched to ECS tasks. Default: - undefined
28785
28866
  :param task_definition: The task definition to use for tasks in the service. [disable-awslint:ref-via-interface]
28786
28867
  :param assign_public_ip: Specifies whether the task's elastic network interface receives a public IP address. If true, each task will receive a public IP address. Default: false
28787
- :param availability_zone_rebalancing: Whether to use Availability Zone rebalancing for the service. If enabled, ``maxHealthyPercent`` must be greater than 100, and the service must not be a target of a Classic Load Balancer. Default: AvailabilityZoneRebalancing.DISABLED
28868
+ :param availability_zone_rebalancing: Whether to use Availability Zone rebalancing for the service. If enabled, ``maxHealthyPercent`` must be greater than 100, and the service must not be a target of a Classic Load Balancer. Default: AvailabilityZoneRebalancing.ENABLED
28788
28869
  :param platform_version: The platform version on which to run your service. If one is not specified, the LATEST platform version is used by default. For more information, see `AWS Fargate Platform Versions <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html>`_ in the Amazon Elastic Container Service Developer Guide. Default: Latest
28789
28870
  :param security_groups: The security groups to associate with the service. If you do not specify a security group, a new security group is created. Default: - A new security group is created.
28790
28871
  :param vpc_subnets: The subnets to associate with the service. Default: - Public subnets if ``assignPublicIp`` is set, otherwise the first available one of Private, Isolated, Public, in that order.
@@ -28797,28 +28878,34 @@ class FargateServiceProps(BaseServiceOptions):
28797
28878
 
28798
28879
  # cluster: ecs.Cluster
28799
28880
  # task_definition: ecs.TaskDefinition
28800
- # elb_alarm: cw.Alarm
28801
-
28802
28881
 
28882
+ service_name = "MyFargateService"
28803
28883
  service = ecs.FargateService(self, "Service",
28884
+ service_name=service_name,
28804
28885
  cluster=cluster,
28805
28886
  task_definition=task_definition,
28806
- min_healthy_percent=100,
28807
- deployment_alarms=ecs.DeploymentAlarmConfig(
28808
- alarm_names=[elb_alarm.alarm_name],
28809
- behavior=ecs.AlarmBehavior.ROLLBACK_ON_ALARM
28810
- )
28887
+ min_healthy_percent=100
28811
28888
  )
28812
28889
 
28813
- # Defining a deployment alarm after the service has been created
28814
- cpu_alarm_name = "MyCpuMetricAlarm"
28815
- cw.Alarm(self, "CPUAlarm",
28816
- alarm_name=cpu_alarm_name,
28817
- metric=service.metric_cpu_utilization(),
28890
+ cpu_metric = cw.Metric(
28891
+ metric_name="CPUUtilization",
28892
+ namespace="AWS/ECS",
28893
+ period=Duration.minutes(5),
28894
+ statistic="Average",
28895
+ dimensions_map={
28896
+ "ClusterName": cluster.cluster_name,
28897
+ # Using `service.serviceName` here will cause a circular dependency
28898
+ "ServiceName": service_name
28899
+ }
28900
+ )
28901
+ my_alarm = cw.Alarm(self, "CPUAlarm",
28902
+ alarm_name="cpuAlarmName",
28903
+ metric=cpu_metric,
28818
28904
  evaluation_periods=2,
28819
28905
  threshold=80
28820
28906
  )
28821
- service.enable_deployment_alarms([cpu_alarm_name],
28907
+
28908
+ service.enable_deployment_alarms([my_alarm.alarm_name],
28822
28909
  behavior=ecs.AlarmBehavior.FAIL_ON_ALARM
28823
28910
  )
28824
28911
  '''
@@ -29149,7 +29236,7 @@ class FargateServiceProps(BaseServiceOptions):
29149
29236
  If enabled, ``maxHealthyPercent`` must be greater than 100, and the service must not be a target
29150
29237
  of a Classic Load Balancer.
29151
29238
 
29152
- :default: AvailabilityZoneRebalancing.DISABLED
29239
+ :default: AvailabilityZoneRebalancing.ENABLED
29153
29240
 
29154
29241
  :see: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-rebalancing.html
29155
29242
  '''
@@ -33997,14 +34084,15 @@ class ListenerRuleConfiguration(
33997
34084
  lifecycle_stages=[ecs.DeploymentLifecycleStage.PRE_SCALE_UP]
33998
34085
  ))
33999
34086
 
34000
- target = service.load_balancer_target(ecs.LoadBalancerTargetOptions(
34087
+ target = service.load_balancer_target(
34001
34088
  container_name="nginx",
34002
34089
  container_port=80,
34003
- protocol=ecs.Protocol.TCP
34004
- ), ecs.AlternateTarget("AlternateTarget",
34005
- alternate_target_group=green_target_group,
34006
- production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
34007
- ))
34090
+ protocol=ecs.Protocol.TCP,
34091
+ alternate_target=ecs.AlternateTarget("AlternateTarget",
34092
+ alternate_target_group=green_target_group,
34093
+ production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
34094
+ )
34095
+ )
34008
34096
 
34009
34097
  target.attach_to_application_target_group(blue_target_group)
34010
34098
  '''
@@ -34055,6 +34143,7 @@ typing.cast(typing.Any, ListenerRuleConfiguration).__jsii_proxy_class__ = lambda
34055
34143
  jsii_struct_bases=[],
34056
34144
  name_mapping={
34057
34145
  "container_name": "containerName",
34146
+ "alternate_target": "alternateTarget",
34058
34147
  "container_port": "containerPort",
34059
34148
  "protocol": "protocol",
34060
34149
  },
@@ -34064,6 +34153,7 @@ class LoadBalancerTargetOptions:
34064
34153
  self,
34065
34154
  *,
34066
34155
  container_name: builtins.str,
34156
+ alternate_target: typing.Optional[IAlternateTarget] = None,
34067
34157
  container_port: typing.Optional[jsii.Number] = None,
34068
34158
  protocol: typing.Optional["Protocol"] = None,
34069
34159
  ) -> None:
@@ -34072,6 +34162,7 @@ class LoadBalancerTargetOptions:
34072
34162
  The port mapping for it must already have been created through addPortMapping().
34073
34163
 
34074
34164
  :param container_name: The name of the container.
34165
+ :param alternate_target: Alternate target configuration for blue/green deployments. Default: - No alternate target configuration
34075
34166
  :param container_port: The port number of the container. Only applicable when using application/network load balancers. Default: - Container port of the first added port mapping.
34076
34167
  :param protocol: The protocol used for the port mapping. Only applicable when using application load balancers. Default: Protocol.TCP
34077
34168
 
@@ -34095,11 +34186,14 @@ class LoadBalancerTargetOptions:
34095
34186
  if __debug__:
34096
34187
  type_hints = typing.get_type_hints(_typecheckingstub__5499166a691d3d9b788ba4a9808f921437da0987c4c4733332600e4e584bf30f)
34097
34188
  check_type(argname="argument container_name", value=container_name, expected_type=type_hints["container_name"])
34189
+ check_type(argname="argument alternate_target", value=alternate_target, expected_type=type_hints["alternate_target"])
34098
34190
  check_type(argname="argument container_port", value=container_port, expected_type=type_hints["container_port"])
34099
34191
  check_type(argname="argument protocol", value=protocol, expected_type=type_hints["protocol"])
34100
34192
  self._values: typing.Dict[builtins.str, typing.Any] = {
34101
34193
  "container_name": container_name,
34102
34194
  }
34195
+ if alternate_target is not None:
34196
+ self._values["alternate_target"] = alternate_target
34103
34197
  if container_port is not None:
34104
34198
  self._values["container_port"] = container_port
34105
34199
  if protocol is not None:
@@ -34112,6 +34206,15 @@ class LoadBalancerTargetOptions:
34112
34206
  assert result is not None, "Required property 'container_name' is missing"
34113
34207
  return typing.cast(builtins.str, result)
34114
34208
 
34209
+ @builtins.property
34210
+ def alternate_target(self) -> typing.Optional[IAlternateTarget]:
34211
+ '''Alternate target configuration for blue/green deployments.
34212
+
34213
+ :default: - No alternate target configuration
34214
+ '''
34215
+ result = self._values.get("alternate_target")
34216
+ return typing.cast(typing.Optional[IAlternateTarget], result)
34217
+
34115
34218
  @builtins.property
34116
34219
  def container_port(self) -> typing.Optional[jsii.Number]:
34117
34220
  '''The port number of the container.
@@ -35756,14 +35859,15 @@ class Protocol(enum.Enum):
35756
35859
  lifecycle_stages=[ecs.DeploymentLifecycleStage.PRE_SCALE_UP]
35757
35860
  ))
35758
35861
 
35759
- target = service.load_balancer_target(ecs.LoadBalancerTargetOptions(
35862
+ target = service.load_balancer_target(
35760
35863
  container_name="nginx",
35761
35864
  container_port=80,
35762
- protocol=ecs.Protocol.TCP
35763
- ), ecs.AlternateTarget("AlternateTarget",
35764
- alternate_target_group=green_target_group,
35765
- production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
35766
- ))
35865
+ protocol=ecs.Protocol.TCP,
35866
+ alternate_target=ecs.AlternateTarget("AlternateTarget",
35867
+ alternate_target_group=green_target_group,
35868
+ production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
35869
+ )
35870
+ )
35767
35871
 
35768
35872
  target.attach_to_application_target_group(blue_target_group)
35769
35873
  '''
@@ -41057,14 +41161,15 @@ class AlternateTarget(
41057
41161
  lifecycle_stages=[ecs.DeploymentLifecycleStage.PRE_SCALE_UP]
41058
41162
  ))
41059
41163
 
41060
- target = service.load_balancer_target(ecs.LoadBalancerTargetOptions(
41164
+ target = service.load_balancer_target(
41061
41165
  container_name="nginx",
41062
41166
  container_port=80,
41063
- protocol=ecs.Protocol.TCP
41064
- ), ecs.AlternateTarget("AlternateTarget",
41065
- alternate_target_group=green_target_group,
41066
- production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
41067
- ))
41167
+ protocol=ecs.Protocol.TCP,
41168
+ alternate_target=ecs.AlternateTarget("AlternateTarget",
41169
+ alternate_target_group=green_target_group,
41170
+ production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
41171
+ )
41172
+ )
41068
41173
 
41069
41174
  target.attach_to_application_target_group(blue_target_group)
41070
41175
  '''
@@ -41838,7 +41943,7 @@ class Cluster(
41838
41943
  :param key_name: (deprecated) Name of SSH keypair to grant access to instances. ``launchTemplate`` and ``mixedInstancesPolicy`` must not be specified when this property is specified You can either specify ``keyPair`` or ``keyName``, not both. Default: - No SSH access will be possible.
41839
41944
  :param key_pair: The SSH keypair to grant access to the instance. Feature flag ``AUTOSCALING_GENERATE_LAUNCH_TEMPLATE`` must be enabled to use this property. ``launchTemplate`` and ``mixedInstancesPolicy`` must not be specified when this property is specified. You can either specify ``keyPair`` or ``keyName``, not both. Default: - No SSH access will be possible.
41840
41945
  :param max_capacity: Maximum number of instances in the fleet. Default: desiredCapacity
41841
- :param max_instance_lifetime: The maximum amount of time that an instance can be in service. The maximum duration applies to all current and future instances in the group. As an instance approaches its maximum duration, it is terminated and replaced, and cannot be used again. You must specify a value of at least 604,800 seconds (7 days). To clear a previously set value, leave this property undefined. Default: none
41946
+ :param max_instance_lifetime: The maximum amount of time that an instance can be in service. The maximum duration applies to all current and future instances in the group. As an instance approaches its maximum duration, it is terminated and replaced, and cannot be used again. You must specify a value of at least 86,400 seconds (one day). To clear a previously set value, leave this property undefined. Default: none
41842
41947
  :param min_capacity: Minimum number of instances in the fleet. Default: 1
41843
41948
  :param new_instances_protected_from_scale_in: Whether newly-launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in. By default, Auto Scaling can terminate an instance at any time after launch when scaling in an Auto Scaling Group, subject to the group's termination policy. However, you may wish to protect newly-launched instances from being scaled in if they are going to run critical applications that should not be prematurely terminated. This flag must be enabled if the Auto Scaling Group will be associated with an ECS Capacity Provider with managed termination protection. Default: false
41844
41949
  :param notifications: Configure autoscaling group to send notifications about fleet changes to an SNS topic(s). Default: - No fleet change notifications will be sent.
@@ -42417,14 +42522,15 @@ class DeploymentLifecycleLambdaTarget(
42417
42522
  lifecycle_stages=[ecs.DeploymentLifecycleStage.PRE_SCALE_UP]
42418
42523
  ))
42419
42524
 
42420
- target = service.load_balancer_target(ecs.LoadBalancerTargetOptions(
42525
+ target = service.load_balancer_target(
42421
42526
  container_name="nginx",
42422
42527
  container_port=80,
42423
- protocol=ecs.Protocol.TCP
42424
- ), ecs.AlternateTarget("AlternateTarget",
42425
- alternate_target_group=green_target_group,
42426
- production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
42427
- ))
42528
+ protocol=ecs.Protocol.TCP,
42529
+ alternate_target=ecs.AlternateTarget("AlternateTarget",
42530
+ alternate_target_group=green_target_group,
42531
+ production_listener=ecs.ListenerRuleConfiguration.application_listener_rule(prod_listener_rule)
42532
+ )
42533
+ )
42428
42534
 
42429
42535
  target.attach_to_application_target_group(blue_target_group)
42430
42536
  '''
@@ -43388,8 +43494,11 @@ class BaseService(
43388
43494
  @jsii.member(jsii_name="loadBalancerTarget")
43389
43495
  def load_balancer_target(
43390
43496
  self,
43391
- options: typing.Union[LoadBalancerTargetOptions, typing.Dict[builtins.str, typing.Any]],
43392
- alternate_options: typing.Optional[IAlternateTarget] = None,
43497
+ *,
43498
+ container_name: builtins.str,
43499
+ alternate_target: typing.Optional[IAlternateTarget] = None,
43500
+ container_port: typing.Optional[jsii.Number] = None,
43501
+ protocol: typing.Optional[Protocol] = None,
43393
43502
  ) -> IEcsLoadBalancerTarget:
43394
43503
  '''Return a load balancing target for a specific container and port.
43395
43504
 
@@ -43400,8 +43509,10 @@ class BaseService(
43400
43509
  Use the return value of this function where you would normally use a load balancer
43401
43510
  target, instead of the ``Service`` object itself.
43402
43511
 
43403
- :param options: -
43404
- :param alternate_options: -
43512
+ :param container_name: The name of the container.
43513
+ :param alternate_target: Alternate target configuration for blue/green deployments. Default: - No alternate target configuration
43514
+ :param container_port: The port number of the container. Only applicable when using application/network load balancers. Default: - Container port of the first added port mapping.
43515
+ :param protocol: The protocol used for the port mapping. Only applicable when using application load balancers. Default: Protocol.TCP
43405
43516
 
43406
43517
  Example::
43407
43518
 
@@ -43416,11 +43527,14 @@ class BaseService(
43416
43527
  )]
43417
43528
  )
43418
43529
  '''
43419
- if __debug__:
43420
- type_hints = typing.get_type_hints(_typecheckingstub__1326df14b5ec04898722ff6a20f7c785c16a07195cce2a207d19792a2ccec402)
43421
- check_type(argname="argument options", value=options, expected_type=type_hints["options"])
43422
- check_type(argname="argument alternate_options", value=alternate_options, expected_type=type_hints["alternate_options"])
43423
- return typing.cast(IEcsLoadBalancerTarget, jsii.invoke(self, "loadBalancerTarget", [options, alternate_options]))
43530
+ options = LoadBalancerTargetOptions(
43531
+ container_name=container_name,
43532
+ alternate_target=alternate_target,
43533
+ container_port=container_port,
43534
+ protocol=protocol,
43535
+ )
43536
+
43537
+ return typing.cast(IEcsLoadBalancerTarget, jsii.invoke(self, "loadBalancerTarget", [options]))
43424
43538
 
43425
43539
  @jsii.member(jsii_name="metric")
43426
43540
  def metric(
@@ -43819,7 +43933,7 @@ class Ec2Service(
43819
43933
  :param id: -
43820
43934
  :param task_definition: The task definition to use for tasks in the service. [disable-awslint:ref-via-interface]
43821
43935
  :param assign_public_ip: Specifies whether the task's elastic network interface receives a public IP address. If true, each task will receive a public IP address. This property is only used for tasks that use the awsvpc network mode. Default: false
43822
- :param availability_zone_rebalancing: Whether to use Availability Zone rebalancing for the service. If enabled: ``maxHealthyPercent`` must be greater than 100; ``daemon`` must be false; if there are any ``placementStrategies``, the first must be "spread across Availability Zones"; there must be no ``placementConstraints`` using ``attribute:ecs.availability-zone``, and the service must not be a target of a Classic Load Balancer. Default: AvailabilityZoneRebalancing.DISABLED
43936
+ :param availability_zone_rebalancing: Whether to use Availability Zone rebalancing for the service. If enabled: ``maxHealthyPercent`` must be greater than 100; ``daemon`` must be false; if there are any ``placementStrategies``, the first must be "spread across Availability Zones"; there must be no ``placementConstraints`` using ``attribute:ecs.availability-zone``, and the service must not be a target of a Classic Load Balancer. Default: AvailabilityZoneRebalancing.ENABLED
43823
43937
  :param daemon: Specifies whether the service will use the daemon scheduling strategy. If true, the service scheduler deploys exactly one task on each container instance in your cluster. When you are using this strategy, do not specify a desired number of tasks or any task placement strategies. Default: false
43824
43938
  :param placement_constraints: The placement constraints to use for tasks in the service. For more information, see `Amazon ECS Task Placement Constraints <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html>`_. Default: - No constraints.
43825
43939
  :param placement_strategies: The placement strategies to use for tasks in the service. For more information, see `Amazon ECS Task Placement Strategies <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html>`_. Default: - No strategies.
@@ -44542,19 +44656,27 @@ class ExternalService(
44542
44656
  @jsii.member(jsii_name="loadBalancerTarget")
44543
44657
  def load_balancer_target(
44544
44658
  self,
44545
- _options: typing.Union[LoadBalancerTargetOptions, typing.Dict[builtins.str, typing.Any]],
44546
- _alternate_options: typing.Optional[IAlternateTarget] = None,
44659
+ *,
44660
+ container_name: builtins.str,
44661
+ alternate_target: typing.Optional[IAlternateTarget] = None,
44662
+ container_port: typing.Optional[jsii.Number] = None,
44663
+ protocol: typing.Optional[Protocol] = None,
44547
44664
  ) -> IEcsLoadBalancerTarget:
44548
44665
  '''Overridden method to throw error as ``loadBalancerTarget`` is not supported for external service.
44549
44666
 
44550
- :param _options: -
44551
- :param _alternate_options: -
44667
+ :param container_name: The name of the container.
44668
+ :param alternate_target: Alternate target configuration for blue/green deployments. Default: - No alternate target configuration
44669
+ :param container_port: The port number of the container. Only applicable when using application/network load balancers. Default: - Container port of the first added port mapping.
44670
+ :param protocol: The protocol used for the port mapping. Only applicable when using application load balancers. Default: Protocol.TCP
44552
44671
  '''
44553
- if __debug__:
44554
- type_hints = typing.get_type_hints(_typecheckingstub__4cd24799babe0f9419c370222cff02dd9c784b1fd9b652c186a1701c0874337d)
44555
- check_type(argname="argument _options", value=_options, expected_type=type_hints["_options"])
44556
- check_type(argname="argument _alternate_options", value=_alternate_options, expected_type=type_hints["_alternate_options"])
44557
- return typing.cast(IEcsLoadBalancerTarget, jsii.invoke(self, "loadBalancerTarget", [_options, _alternate_options]))
44672
+ _options = LoadBalancerTargetOptions(
44673
+ container_name=container_name,
44674
+ alternate_target=alternate_target,
44675
+ container_port=container_port,
44676
+ protocol=protocol,
44677
+ )
44678
+
44679
+ return typing.cast(IEcsLoadBalancerTarget, jsii.invoke(self, "loadBalancerTarget", [_options]))
44558
44680
 
44559
44681
  @jsii.member(jsii_name="registerLoadBalancerTargets")
44560
44682
  def register_load_balancer_targets(self, *_targets: EcsTarget) -> None:
@@ -44734,28 +44856,34 @@ class FargateService(
44734
44856
 
44735
44857
  # cluster: ecs.Cluster
44736
44858
  # task_definition: ecs.TaskDefinition
44737
- # elb_alarm: cw.Alarm
44738
-
44739
44859
 
44860
+ service_name = "MyFargateService"
44740
44861
  service = ecs.FargateService(self, "Service",
44862
+ service_name=service_name,
44741
44863
  cluster=cluster,
44742
44864
  task_definition=task_definition,
44743
- min_healthy_percent=100,
44744
- deployment_alarms=ecs.DeploymentAlarmConfig(
44745
- alarm_names=[elb_alarm.alarm_name],
44746
- behavior=ecs.AlarmBehavior.ROLLBACK_ON_ALARM
44747
- )
44865
+ min_healthy_percent=100
44748
44866
  )
44749
44867
 
44750
- # Defining a deployment alarm after the service has been created
44751
- cpu_alarm_name = "MyCpuMetricAlarm"
44752
- cw.Alarm(self, "CPUAlarm",
44753
- alarm_name=cpu_alarm_name,
44754
- metric=service.metric_cpu_utilization(),
44868
+ cpu_metric = cw.Metric(
44869
+ metric_name="CPUUtilization",
44870
+ namespace="AWS/ECS",
44871
+ period=Duration.minutes(5),
44872
+ statistic="Average",
44873
+ dimensions_map={
44874
+ "ClusterName": cluster.cluster_name,
44875
+ # Using `service.serviceName` here will cause a circular dependency
44876
+ "ServiceName": service_name
44877
+ }
44878
+ )
44879
+ my_alarm = cw.Alarm(self, "CPUAlarm",
44880
+ alarm_name="cpuAlarmName",
44881
+ metric=cpu_metric,
44755
44882
  evaluation_periods=2,
44756
44883
  threshold=80
44757
44884
  )
44758
- service.enable_deployment_alarms([cpu_alarm_name],
44885
+
44886
+ service.enable_deployment_alarms([my_alarm.alarm_name],
44759
44887
  behavior=ecs.AlarmBehavior.FAIL_ON_ALARM
44760
44888
  )
44761
44889
  '''
@@ -44798,7 +44926,7 @@ class FargateService(
44798
44926
  :param id: -
44799
44927
  :param task_definition: The task definition to use for tasks in the service. [disable-awslint:ref-via-interface]
44800
44928
  :param assign_public_ip: Specifies whether the task's elastic network interface receives a public IP address. If true, each task will receive a public IP address. Default: false
44801
- :param availability_zone_rebalancing: Whether to use Availability Zone rebalancing for the service. If enabled, ``maxHealthyPercent`` must be greater than 100, and the service must not be a target of a Classic Load Balancer. Default: AvailabilityZoneRebalancing.DISABLED
44929
+ :param availability_zone_rebalancing: Whether to use Availability Zone rebalancing for the service. If enabled, ``maxHealthyPercent`` must be greater than 100, and the service must not be a target of a Classic Load Balancer. Default: AvailabilityZoneRebalancing.ENABLED
44802
44930
  :param platform_version: The platform version on which to run your service. If one is not specified, the LATEST platform version is used by default. For more information, see `AWS Fargate Platform Versions <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html>`_ in the Amazon Elastic Container Service Developer Guide. Default: Latest
44803
44931
  :param security_groups: The security groups to associate with the service. If you do not specify a security group, a new security group is created. Default: - A new security group is created.
44804
44932
  :param vpc_subnets: The subnets to associate with the service. Default: - Public subnets if ``assignPublicIp`` is set, otherwise the first available one of Private, Isolated, Public, in that order.
@@ -48394,6 +48522,7 @@ def _typecheckingstub__c964a7ba26c195318cd3937b823b36facecf4120aeb9196876feb206f
48394
48522
  def _typecheckingstub__5499166a691d3d9b788ba4a9808f921437da0987c4c4733332600e4e584bf30f(
48395
48523
  *,
48396
48524
  container_name: builtins.str,
48525
+ alternate_target: typing.Optional[IAlternateTarget] = None,
48397
48526
  container_port: typing.Optional[jsii.Number] = None,
48398
48527
  protocol: typing.Optional[Protocol] = None,
48399
48528
  ) -> None:
@@ -49500,13 +49629,6 @@ def _typecheckingstub__027c7741168086e6dc84ce3b453e99740a28a87dabd7b69b28195c0b3
49500
49629
  """Type checking stubs"""
49501
49630
  pass
49502
49631
 
49503
- def _typecheckingstub__1326df14b5ec04898722ff6a20f7c785c16a07195cce2a207d19792a2ccec402(
49504
- options: typing.Union[LoadBalancerTargetOptions, typing.Dict[builtins.str, typing.Any]],
49505
- alternate_options: typing.Optional[IAlternateTarget] = None,
49506
- ) -> None:
49507
- """Type checking stubs"""
49508
- pass
49509
-
49510
49632
  def _typecheckingstub__fb3b6cd83a49e029a6aab0309e4bf6a856a09b82a0d6752ebc4b8057753a9902(
49511
49633
  metric_name: builtins.str,
49512
49634
  *,
@@ -49785,13 +49907,6 @@ def _typecheckingstub__6a882b6874d4ad85f277f48ab87544e61c1ded22af9e05c1fc5cf0aea
49785
49907
  """Type checking stubs"""
49786
49908
  pass
49787
49909
 
49788
- def _typecheckingstub__4cd24799babe0f9419c370222cff02dd9c784b1fd9b652c186a1701c0874337d(
49789
- _options: typing.Union[LoadBalancerTargetOptions, typing.Dict[builtins.str, typing.Any]],
49790
- _alternate_options: typing.Optional[IAlternateTarget] = None,
49791
- ) -> None:
49792
- """Type checking stubs"""
49793
- pass
49794
-
49795
49910
  def _typecheckingstub__8c04543cf19a902fa2afce6445c2c60d81551c375dc4a44e88bef45930d140e4(
49796
49911
  *_targets: EcsTarget,
49797
49912
  ) -> None: