Class NetworkLoadBalancedTaskImageProps
Options for configuring a new container.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.ECS.Patterns
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class NetworkLoadBalancedTaskImageProps : Object, INetworkLoadBalancedTaskImageProps
Syntax (vb)
Public Class NetworkLoadBalancedTaskImageProps
Inherits Object
Implements INetworkLoadBalancedTaskImageProps
Remarks
ExampleMetadata: infused
Examples
// Two network load balancers, each with their own listener and target group.
Cluster cluster;
var loadBalancedEc2Service = new NetworkMultipleTargetGroupsEc2Service(this, "Service", new NetworkMultipleTargetGroupsEc2ServiceProps {
Cluster = cluster,
MemoryLimitMiB = 256,
TaskImageOptions = new NetworkLoadBalancedTaskImageProps {
Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample")
},
LoadBalancers = new [] { new NetworkLoadBalancerProps {
Name = "lb1",
Listeners = new [] { new NetworkListenerProps {
Name = "listener1"
} }
}, new NetworkLoadBalancerProps {
Name = "lb2",
Listeners = new [] { new NetworkListenerProps {
Name = "listener2"
} }
} },
TargetGroups = new [] { new NetworkTargetProps {
ContainerPort = 80,
Listener = "listener1"
}, new NetworkTargetProps {
ContainerPort = 90,
Listener = "listener2"
} }
});
Synopsis
Constructors
Network |
Properties
Container |
The container name value to be specified in the task definition. |
Container |
A list of port numbers on the container that is bound to the user-specified or automatically assigned host port. |
Docker |
A key/value map of labels to add to the container. |
Enable |
Flag to indicate whether to enable logging. |
Environment | The environment variables to pass to the container. |
Execution |
The name of the task execution IAM role that grants the Amazon ECS container agent permission to call AWS APIs on your behalf. |
Family | The name of a family that this task definition is registered to. |
Image | The image used to start a container. |
Log |
The log driver to use. |
Secrets | The secrets to expose to the container as an environment variable. |
Task |
The name of the task IAM role that grants containers in the task permission to call AWS APIs on your behalf. |
Constructors
NetworkLoadBalancedTaskImageProps()
public NetworkLoadBalancedTaskImageProps()
Properties
ContainerName
The container name value to be specified in the task definition.
public string ContainerName { get; set; }
Property Value
System.
Remarks
Default: - none
ContainerPorts
A list of port numbers on the container that is bound to the user-specified or automatically assigned host port.
public double[] ContainerPorts { get; set; }
Property Value
System.
Remarks
If you are using containers in a task with the awsvpc or host network mode, exposed ports should be specified using containerPort. If you are using containers in a task with the bridge network mode and you specify a container port and not a host port, your container automatically receives a host port in the ephemeral port range.
Port mappings that are automatically assigned in this way do not count toward the 100 reserved ports limit of a container instance.
For more information, see hostPort.
Default: - [80]
DockerLabels
A key/value map of labels to add to the container.
public IDictionary<string, string> DockerLabels { get; set; }
Property Value
System.
Remarks
Default: - No labels.
EnableLogging
Flag to indicate whether to enable logging.
public Nullable<bool> EnableLogging { get; set; }
Property Value
System.
Remarks
Default: true
Environment
The environment variables to pass to the container.
public IDictionary<string, string> Environment { get; set; }
Property Value
System.
Remarks
Default: - No environment variables.
ExecutionRole
The name of the task execution IAM role that grants the Amazon ECS container agent permission to call AWS APIs on your behalf.
public IRole ExecutionRole { get; set; }
Property Value
Remarks
Default: - No value
Family
The name of a family that this task definition is registered to.
public string Family { get; set; }
Property Value
System.
Remarks
A family groups multiple versions of a task definition.
Default: - Automatically generated name.
Image
The image used to start a container.
public ContainerImage Image { get; set; }
Property Value
Remarks
Image or taskDefinition must be specified, but not both.
Default: - none
LogDriver
The log driver to use.
public LogDriver LogDriver { get; set; }
Property Value
Remarks
Default: - AwsLogDriver if enableLogging is true
Secrets
The secrets to expose to the container as an environment variable.
public IDictionary<string, Secret> Secrets { get; set; }
Property Value
System.
Remarks
Default: - No secret environment variables.
TaskRole
The name of the task IAM role that grants containers in the task permission to call AWS APIs on your behalf.
public IRole TaskRole { get; set; }
Property Value
Remarks
Default: - A task role is automatically created for you.