Class ApplicationMultipleTargetGroupsEc2ServiceProps
The properties for the ApplicationMultipleTargetGroupsEc2Service service.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.ECS.Patterns
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ApplicationMultipleTargetGroupsEc2ServiceProps : Object, IApplicationMultipleTargetGroupsEc2ServiceProps, IApplicationMultipleTargetGroupsServiceBaseProps
Syntax (vb)
Public Class ApplicationMultipleTargetGroupsEc2ServiceProps
Inherits Object
Implements IApplicationMultipleTargetGroupsEc2ServiceProps, IApplicationMultipleTargetGroupsServiceBaseProps
Remarks
ExampleMetadata: infused
Examples
// One application load balancer with one listener and two target groups.
Cluster cluster;
var loadBalancedEc2Service = new ApplicationMultipleTargetGroupsEc2Service(this, "Service", new ApplicationMultipleTargetGroupsEc2ServiceProps {
Cluster = cluster,
MemoryLimitMiB = 256,
TaskImageOptions = new ApplicationLoadBalancedTaskImageProps {
Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample")
},
TargetGroups = new [] { new ApplicationTargetProps {
ContainerPort = 80
}, new ApplicationTargetProps {
ContainerPort = 90,
PathPattern = "a/b/c",
Priority = 10
} }
});
Synopsis
Constructors
ApplicationMultipleTargetGroupsEc2ServiceProps() |
Properties
CloudMapOptions | The options for configuring an Amazon ECS service to use service discovery. |
Cluster | The name of the cluster that hosts the service. |
Cpu | The minimum number of CPU units to reserve for the container. |
DesiredCount | The desired number of instantiations of the task definition to keep running on the service. |
EnableECSManagedTags | Specifies whether to enable Amazon ECS managed tags for the tasks within the service. |
EnableExecuteCommand | Whether ECS Exec should be enabled. |
HealthCheckGracePeriod | The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. |
LoadBalancers | The application load balancer that will serve traffic to the service. |
MemoryLimitMiB | The amount (in MiB) of memory to present to the container. |
MemoryReservationMiB | The soft limit (in MiB) of memory to reserve for the container. |
PlacementConstraints | The placement constraints to use for tasks in the service. |
PlacementStrategies | The placement strategies to use for tasks in the service. |
PropagateTags | Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. |
ServiceName | The name of the service. |
TargetGroups | Properties to specify ALB target groups. |
TaskDefinition | The task definition to use for tasks in the service. Only one of TaskDefinition or TaskImageOptions must be specified. |
TaskImageOptions | The properties required to create a new task definition. |
Vpc | The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. |
Constructors
ApplicationMultipleTargetGroupsEc2ServiceProps()
public ApplicationMultipleTargetGroupsEc2ServiceProps()
Properties
CloudMapOptions
The options for configuring an Amazon ECS service to use service discovery.
public ICloudMapOptions CloudMapOptions { get; set; }
Property Value
Remarks
Default: - AWS Cloud Map service discovery is not enabled.
Cluster
The name of the cluster that hosts the service.
public ICluster Cluster { get; set; }
Property Value
Remarks
If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc.
Default: - create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you.
Cpu
The minimum number of CPU units to reserve for the container.
public Nullable<double> Cpu { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Valid values, which determines your range of valid values for the memory parameter:
Default: - No minimum CPU units reserved.
DesiredCount
The desired number of instantiations of the task definition to keep running on the service.
public Nullable<double> DesiredCount { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Default: - The default is 1 for all new services and uses the existing service's desired count when updating an existing service.
EnableECSManagedTags
Specifies whether to enable Amazon ECS managed tags for the tasks within the service.
public Nullable<bool> EnableECSManagedTags { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
For more information, see Tagging Your Amazon ECS Resources
Default: false
EnableExecuteCommand
Whether ECS Exec should be enabled.
public Nullable<bool> EnableExecuteCommand { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: - false
HealthCheckGracePeriod
The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started.
public Duration HealthCheckGracePeriod { get; set; }
Property Value
Remarks
Default: - defaults to 60 seconds if at least one load balancer is in-use and it is not already set
LoadBalancers
The application load balancer that will serve traffic to the service.
public IApplicationLoadBalancerProps[] LoadBalancers { get; set; }
Property Value
IApplicationLoadBalancerProps[]
Remarks
Default: - a new load balancer with a listener will be created.
MemoryLimitMiB
The amount (in MiB) of memory to present to the container.
public Nullable<double> MemoryLimitMiB { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
If your container attempts to exceed the allocated memory, the container is terminated.
At least one of memoryLimitMiB and memoryReservationMiB is required.
Default: - No memory limit.
MemoryReservationMiB
The soft limit (in MiB) of memory to reserve for the container.
public Nullable<double> MemoryReservationMiB { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
When system memory is under heavy contention, Docker attempts to keep the container memory to this soft limit. However, your container can consume more memory when it needs to, up to either the hard limit specified with the memory parameter (if applicable), or all of the available memory on the container instance, whichever comes first.
At least one of memoryLimitMiB and memoryReservationMiB is required.
Note that this setting will be ignored if TaskImagesOptions is specified
Default: - No memory reserved.
PlacementConstraints
The placement constraints to use for tasks in the service.
public PlacementConstraint[] PlacementConstraints { get; set; }
Property Value
Remarks
For more information, see Amazon ECS Task Placement Constraints.
Default: - No constraints.
PlacementStrategies
The placement strategies to use for tasks in the service.
public PlacementStrategy[] PlacementStrategies { get; set; }
Property Value
Remarks
For more information, see Amazon ECS Task Placement Strategies.
Default: - No strategies.
PropagateTags
Specifies whether to propagate the tags from the task definition or the service to the tasks in the service.
public Nullable<PropagatedTagSource> PropagateTags { get; set; }
Property Value
System.Nullable<PropagatedTagSource>
Remarks
Tags can only be propagated to the tasks within the service during service creation.
Default: - none
ServiceName
The name of the service.
public string ServiceName { get; set; }
Property Value
System.String
Remarks
Default: - CloudFormation-generated name.
TargetGroups
Properties to specify ALB target groups.
public IApplicationTargetProps[] TargetGroups { get; set; }
Property Value
Remarks
Default: - default portMapping registered as target group and attached to the first defined listener
TaskDefinition
The task definition to use for tasks in the service. Only one of TaskDefinition or TaskImageOptions must be specified.
public Ec2TaskDefinition TaskDefinition { get; set; }
Property Value
Remarks
[disable-awslint:ref-via-interface]
Default: - none
TaskImageOptions
The properties required to create a new task definition.
public IApplicationLoadBalancedTaskImageProps TaskImageOptions { get; set; }
Property Value
IApplicationLoadBalancedTaskImageProps
Remarks
Only one of TaskDefinition or TaskImageOptions must be specified.
Default: none
Vpc
The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed.
public IVpc Vpc { get; set; }
Property Value
Remarks
If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster.
Default: - uses the VPC defined in the cluster or creates a new VPC.