ScheduledEc2TaskImageOptions
- class aws_cdk.aws_ecs_patterns.ScheduledEc2TaskImageOptions(*, image, command=None, container_name=None, environment=None, log_driver=None, secrets=None, cpu=None, memory_limit_mib=None, memory_reservation_mib=None)
Bases:
ScheduledTaskImageProps
The properties for the ScheduledEc2Task using an image.
- Parameters:
image (
ContainerImage
) – The image used to start a container. Image or taskDefinition must be specified, but not both. Default: - nonecommand (
Optional
[Sequence
[str
]]) – The command that is passed to the container. If you provide a shell command as a single string, you have to quote command-line arguments. Default: - CMD value built into container image.container_name (
Optional
[str
]) – Optional name for the container added. Default: - ScheduledContainerenvironment (
Optional
[Mapping
[str
,str
]]) – The environment variables to pass to the container. Default: nonelog_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.cpu (
Union
[int
,float
,None
]) – The minimum number of CPU units to reserve for the container. Default: nonememory_limit_mib (
Union
[int
,float
,None
]) – The hard limit (in MiB) of memory to present to the container. If your container attempts to exceed the allocated memory, the container is terminated. At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services. Default: - No memory limit.memory_reservation_mib (
Union
[int
,float
,None
]) – The soft limit (in MiB) of memory to reserve for the container. When system memory is under contention, Docker attempts to keep the container memory within the limit. If the container requires more memory, it can consume up to the value specified by the Memory property or all of the available memory on the container instance—whichever comes first. At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services. Default: - No memory reserved.
- ExampleMetadata:
infused
Example:
# Instantiate an Amazon EC2 Task to run at a scheduled interval # cluster: ecs.Cluster ecs_scheduled_task = ecs_patterns.ScheduledEc2Task(self, "ScheduledTask", cluster=cluster, scheduled_ec2_task_image_options=ecsPatterns.ScheduledEc2TaskImageOptions( image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample"), memory_limit_mi_b=256, environment={"name": "TRIGGER", "value": "CloudWatch Events"} ), schedule=appscaling.Schedule.expression("rate(1 minute)"), enabled=True, rule_name="sample-scheduled-task-rule" )
Attributes
- command
The command that is passed to the container.
If you provide a shell command as a single string, you have to quote command-line arguments.
- Default:
CMD value built into container image.
- container_name
Optional name for the container added.
- Default:
ScheduledContainer
- cpu
The minimum number of CPU units to reserve for the container.
- Default:
none
- environment
The environment variables to pass to the container.
- Default:
none
- image
The image used to start a container.
Image or taskDefinition must be specified, but not both.
- Default:
none
- log_driver
The log driver to use.
- Default:
AwsLogDriver if enableLogging is true
- memory_limit_mib
The hard limit (in MiB) of memory to present to the container.
If your container attempts to exceed the allocated memory, the container is terminated.
At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.
- Default:
No memory limit.
- memory_reservation_mib
The soft limit (in MiB) of memory to reserve for the container.
When system memory is under contention, Docker attempts to keep the container memory within the limit. If the container requires more memory, it can consume up to the value specified by the Memory property or all of the available memory on the container instance—whichever comes first.
At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.
- Default:
No memory reserved.
- secrets
The secret to expose to the container as an environment variable.
- Default:
No secret environment variables.