ApplicationLoadBalancedTaskImageOptions
- class aws_cdk.aws_ecs_patterns.ApplicationLoadBalancedTaskImageOptions(*, image, command=None, container_name=None, container_port=None, docker_labels=None, enable_logging=None, entry_point=None, environment=None, execution_role=None, family=None, log_driver=None, secrets=None, task_role=None)
Bases:
object
- Parameters:
image (
ContainerImage
) – The image used to start a container. Image or taskDefinition must be specified, not both. Default: - nonecommand (
Optional
[Sequence
[str
]]) – The command that’s passed to the container. If there are multiple arguments, make sure that each argument is a separated string in the array. This parameter maps toCmd
in the Create a container section of the Docker Remote API and theCOMMAND
parameter to docker run. For more information about the DockerCMD
parameter, see https://docs.docker.com/engine/reference/builder/#cmd. Default: nonecontainer_name (
Optional
[str
]) – The container name value to be specified in the task definition. Default: - nonecontainer_port (
Union
[int
,float
,None
]) – The port number on the container that is bound to the user-specified or automatically assigned host port. 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: 80docker_labels (
Optional
[Mapping
[str
,str
]]) – A key/value map of labels to add to the container. Default: - No labels.enable_logging (
Optional
[bool
]) – Flag to indicate whether to enable logging. Default: trueentry_point (
Optional
[Sequence
[str
]]) –The entry point that’s passed to the container. This parameter maps to
Entrypoint
in the Create a container section of the Docker Remote API and the--entrypoint
option to docker run. For more information about the DockerENTRYPOINT
parameter, see https://docs.docker.com/engine/reference/builder/#entrypoint. Default: noneenvironment (
Optional
[Mapping
[str
,str
]]) – The environment variables to pass to the container. Default: - No environment variables.execution_role (
Optional
[IRole
]) – The name of the task execution IAM role that grants the Amazon ECS container agent permission to call AWS APIs on your behalf. Default: - No valuefamily (
Optional
[str
]) – The name of a family that this task definition is registered to. A family groups multiple versions of a task definition. Default: - Automatically generated name.log_driver (
Optional
[LogDriver
]) – The log driver to use. Default: - AwsLogDriver if enableLogging is truesecrets (
Optional
[Mapping
[str
,Secret
]]) – The secret to expose to the container as an environment variable. Default: - No secret environment variables.task_role (
Optional
[IRole
]) – The name of the task IAM role that grants containers in the task permission to call AWS APIs on your behalf. Default: - A task role is automatically created for you.
- ExampleMetadata:
infused
Example:
# cluster: ecs.Cluster load_balanced_fargate_service = ecs_patterns.ApplicationLoadBalancedFargateService(self, "Service", cluster=cluster, memory_limit_mi_b=1024, desired_count=1, cpu=512, task_image_options=ecsPatterns.ApplicationLoadBalancedTaskImageOptions( image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample") ), task_subnets=ec2.SubnetSelection( subnets=[ec2.Subnet.from_subnet_id(self, "subnet", "VpcISOLATEDSubnet1Subnet80F07FA0")] ), load_balancer_name="application-lb-name" )
Attributes
- command
The command that’s passed to the container.
If there are multiple arguments, make sure that each argument is a separated string in the array.
This parameter maps to
Cmd
in the Create a container section of the Docker Remote API and theCOMMAND
parameter to docker run.For more information about the Docker
CMD
parameter, see https://docs.docker.com/engine/reference/builder/#cmd.- Default:
none
- container_name
The container name value to be specified in the task definition.
- Default:
none
- container_port
The port number on the container that is bound to the user-specified or automatically assigned host port.
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
- docker_labels
A key/value map of labels to add to the container.
- Default:
No labels.
- enable_logging
Flag to indicate whether to enable logging.
- Default:
true
- entry_point
The entry point that’s passed to the container.
This parameter maps to
Entrypoint
in the Create a container section of the Docker Remote API and the--entrypoint
option to docker run.For more information about the Docker
ENTRYPOINT
parameter, see https://docs.docker.com/engine/reference/builder/#entrypoint.- Default:
none
- environment
The environment variables to pass to the container.
- Default:
No environment variables.
- execution_role
The name of the task execution IAM role that grants the Amazon ECS container agent permission to call AWS APIs on your behalf.
- Default:
No value
- family
The name of a family that this task definition is registered to.
A family groups multiple versions of a task definition.
- Default:
Automatically generated name.
- image
The image used to start a container.
Image or taskDefinition must be specified, not both.
- Default:
none
- log_driver
The log driver to use.
- Default:
AwsLogDriver if enableLogging is true
- secrets
The secret to expose to the container as an environment variable.
- Default:
No secret environment variables.
- task_role
The name of the task IAM role that grants containers in the task permission to call AWS APIs on your behalf.
- Default:
A task role is automatically created for you.