Interface INetworkLoadBalancedTaskImageProps
Options for configuring a new container.
Namespace: Amazon.CDK.AWS.ECS.Patterns
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface INetworkLoadBalancedTaskImageProps
Syntax (vb)
Public Interface 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
Properties
ContainerName | The container name value to be specified in the task definition. |
ContainerPorts | A list of port numbers on the container that is bound to the user-specified or automatically assigned host port. |
DockerLabels | A key/value map of labels to add to the container. |
EnableLogging | Flag to indicate whether to enable logging. |
Environment | The environment variables to pass to the container. |
ExecutionRole | 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. |
LogDriver | The log driver to use. |
Secrets | The secrets to expose to the container as an environment variable. |
TaskRole | The name of the task IAM role that grants containers in the task permission to call AWS APIs on your behalf. |
Properties
ContainerName
The container name value to be specified in the task definition.
virtual string ContainerName { get; }
Property Value
System.String
Remarks
Default: - none
ContainerPorts
A list of port numbers on the container that is bound to the user-specified or automatically assigned host port.
virtual double[] ContainerPorts { get; }
Property Value
System.Double[]
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.
virtual IDictionary<string, string> DockerLabels { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String>
Remarks
Default: - No labels.
EnableLogging
Flag to indicate whether to enable logging.
virtual Nullable<bool> EnableLogging { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: true
Environment
The environment variables to pass to the container.
virtual IDictionary<string, string> Environment { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String>
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.
virtual IRole ExecutionRole { get; }
Property Value
Remarks
Default: - No value
Family
The name of a family that this task definition is registered to.
virtual string Family { get; }
Property Value
System.String
Remarks
A family groups multiple versions of a task definition.
Default: - Automatically generated name.
Image
The image used to start a container.
ContainerImage Image { get; }
Property Value
Remarks
Image or taskDefinition must be specified, but not both.
Default: - none
LogDriver
The log driver to use.
virtual LogDriver LogDriver { get; }
Property Value
Remarks
Default: - AwsLogDriver if enableLogging is true
Secrets
The secrets to expose to the container as an environment variable.
virtual IDictionary<string, Secret> Secrets { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, Secret>
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.
virtual IRole TaskRole { get; }
Property Value
Remarks
Default: - A task role is automatically created for you.