Show / Hide Table of Contents

Class ApplicationLoadBalancedTaskImageProps

Options for configuring a new container.

Inheritance
object
ApplicationLoadBalancedTaskImageProps
Implements
IApplicationLoadBalancedTaskImageProps
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Amazon.CDK.AWS.ECS.Patterns
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ApplicationLoadBalancedTaskImageProps : IApplicationLoadBalancedTaskImageProps
Syntax (vb)
Public Class ApplicationLoadBalancedTaskImageProps Implements IApplicationLoadBalancedTaskImageProps
Remarks

ExampleMetadata: infused

Examples
using Amazon.CDK.AWS.CertificateManager;
            using Amazon.CDK.AWS.EC2;
            using Amazon.CDK.AWS.ECS;
            using Amazon.CDK.AWS.ElasticLoadBalancingV2;
            using Amazon.CDK.AWS.Route53;

            var vpc = new Vpc(this, "Vpc", new VpcProps { MaxAzs = 1 });
            var loadBalancedFargateService = new ApplicationMultipleTargetGroupsFargateService(this, "myService", new ApplicationMultipleTargetGroupsFargateServiceProps {
                Cluster = new Cluster(this, "EcsCluster", new ClusterProps { Vpc = vpc }),
                MemoryLimitMiB = 256,
                TaskImageOptions = new ApplicationLoadBalancedTaskImageProps {
                    Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample")
                },
                EnableExecuteCommand = true,
                LoadBalancers = new [] { new ApplicationLoadBalancerProps {
                    Name = "lb",
                    IdleTimeout = Duration.Seconds(400),
                    DomainName = "api.example.com",
                    DomainZone = new PublicHostedZone(this, "HostedZone", new PublicHostedZoneProps { ZoneName = "example.com" }),
                    Listeners = new [] { new ApplicationListenerProps {
                        Name = "listener",
                        Protocol = ApplicationProtocol.HTTPS,
                        Certificate = Certificate.FromCertificateArn(this, "Cert", "helloworld"),
                        SslPolicy = SslPolicy.TLS12_EXT
                    } }
                }, new ApplicationLoadBalancerProps {
                    Name = "lb2",
                    IdleTimeout = Duration.Seconds(120),
                    DomainName = "frontend.com",
                    DomainZone = new PublicHostedZone(this, "HostedZone", new PublicHostedZoneProps { ZoneName = "frontend.com" }),
                    Listeners = new [] { new ApplicationListenerProps {
                        Name = "listener2",
                        Protocol = ApplicationProtocol.HTTPS,
                        Certificate = Certificate.FromCertificateArn(this, "Cert2", "helloworld"),
                        SslPolicy = SslPolicy.TLS12_EXT
                    } }
                } },
                TargetGroups = new [] { new ApplicationTargetProps {
                    ContainerPort = 80,
                    Listener = "listener"
                }, new ApplicationTargetProps {
                    ContainerPort = 90,
                    PathPattern = "a/b/c",
                    Priority = 10,
                    Listener = "listener"
                }, new ApplicationTargetProps {
                    ContainerPort = 443,
                    Listener = "listener2"
                }, new ApplicationTargetProps {
                    ContainerPort = 80,
                    PathPattern = "a/b/c",
                    Priority = 10,
                    Listener = "listener2"
                } }
            });

Synopsis

Constructors

ApplicationLoadBalancedTaskImageProps()

Options for configuring a new container.

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.

Constructors

ApplicationLoadBalancedTaskImageProps()

Options for configuring a new container.

public ApplicationLoadBalancedTaskImageProps()
Remarks

ExampleMetadata: infused

Examples
using Amazon.CDK.AWS.CertificateManager;
            using Amazon.CDK.AWS.EC2;
            using Amazon.CDK.AWS.ECS;
            using Amazon.CDK.AWS.ElasticLoadBalancingV2;
            using Amazon.CDK.AWS.Route53;

            var vpc = new Vpc(this, "Vpc", new VpcProps { MaxAzs = 1 });
            var loadBalancedFargateService = new ApplicationMultipleTargetGroupsFargateService(this, "myService", new ApplicationMultipleTargetGroupsFargateServiceProps {
                Cluster = new Cluster(this, "EcsCluster", new ClusterProps { Vpc = vpc }),
                MemoryLimitMiB = 256,
                TaskImageOptions = new ApplicationLoadBalancedTaskImageProps {
                    Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample")
                },
                EnableExecuteCommand = true,
                LoadBalancers = new [] { new ApplicationLoadBalancerProps {
                    Name = "lb",
                    IdleTimeout = Duration.Seconds(400),
                    DomainName = "api.example.com",
                    DomainZone = new PublicHostedZone(this, "HostedZone", new PublicHostedZoneProps { ZoneName = "example.com" }),
                    Listeners = new [] { new ApplicationListenerProps {
                        Name = "listener",
                        Protocol = ApplicationProtocol.HTTPS,
                        Certificate = Certificate.FromCertificateArn(this, "Cert", "helloworld"),
                        SslPolicy = SslPolicy.TLS12_EXT
                    } }
                }, new ApplicationLoadBalancerProps {
                    Name = "lb2",
                    IdleTimeout = Duration.Seconds(120),
                    DomainName = "frontend.com",
                    DomainZone = new PublicHostedZone(this, "HostedZone", new PublicHostedZoneProps { ZoneName = "frontend.com" }),
                    Listeners = new [] { new ApplicationListenerProps {
                        Name = "listener2",
                        Protocol = ApplicationProtocol.HTTPS,
                        Certificate = Certificate.FromCertificateArn(this, "Cert2", "helloworld"),
                        SslPolicy = SslPolicy.TLS12_EXT
                    } }
                } },
                TargetGroups = new [] { new ApplicationTargetProps {
                    ContainerPort = 80,
                    Listener = "listener"
                }, new ApplicationTargetProps {
                    ContainerPort = 90,
                    PathPattern = "a/b/c",
                    Priority = 10,
                    Listener = "listener"
                }, new ApplicationTargetProps {
                    ContainerPort = 443,
                    Listener = "listener2"
                }, new ApplicationTargetProps {
                    ContainerPort = 80,
                    PathPattern = "a/b/c",
                    Priority = 10,
                    Listener = "listener2"
                } }
            });

Properties

ContainerName

The container name value to be specified in the task definition.

public string? ContainerName { get; set; }
Property Value

string

Remarks

Default: - web

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

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.

public IDictionary<string, string>? DockerLabels { get; set; }
Property Value

IDictionary<string, string>

Remarks

Default: - No labels.

EnableLogging

Flag to indicate whether to enable logging.

public bool? EnableLogging { get; set; }
Property Value

bool?

Remarks

Default: true

Environment

The environment variables to pass to the container.

public IDictionary<string, string>? Environment { get; set; }
Property Value

IDictionary<string, 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.

public IRole? ExecutionRole { get; set; }
Property Value

IRole

Remarks

Default: - No value

Family

The name of a family that this task definition is registered to.

public string? Family { get; set; }
Property Value

string

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

ContainerImage

Remarks

Image or taskDefinition must be specified, not both.

Default: - none

LogDriver

The log driver to use.

public LogDriver? LogDriver { get; set; }
Property Value

LogDriver

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

IDictionary<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.

public IRole? TaskRole { get; set; }
Property Value

IRole

Remarks

Default: - A task role is automatically created for you.

Implements

IApplicationLoadBalancedTaskImageProps
Back to top Generated by DocFX