ScheduledEc2TaskImageOptions Struct
The properties for the ScheduledEc2Task using an image.
Example
// Instantiate an Amazon EC2 Task to run at a scheduled interval
declare const cluster: ecs.Cluster;
const ecsScheduledTask = new ecsPatterns.ScheduledEc2Task(this, 'ScheduledTask', {
cluster,
scheduledEc2TaskImageOptions: {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
memoryLimitMiB: 256,
environment: { name: 'TRIGGER', value: 'CloudWatch Events' },
},
schedule: appscaling.Schedule.expression('rate(1 minute)'),
enabled: true,
ruleName: 'sample-scheduled-task-rule',
});
Properties
commandoptionalstring[]commandoptionaltyping.List[str]commandoptionalList<String>Commandoptionalstring[]Commandoptional*[]*string#Default: CMD value built into container image.
If you provide a shell command as a single string, you have to quote command-line arguments.
containerNameoptionalstringcontainer_nameoptionalstrcontainerNameoptionalStringContainerNameoptionalstringContainerNameoptional*string= ScheduledContainer#environmentoptional{ [key: string]: string }environmentoptionaltyping.Mapping[str, str]environmentoptionalMap<String, String>EnvironmentoptionalIDictionary<string, string>Environmentoptional*map[string]*string= none#imageContainerImageimageContainerImageimageContainerImageImageContainerImageImageContainerImage= nonerequired#Image or taskDefinition must be specified, but not both.
logDriveroptionalLogDriverlog_driveroptionalLogDriverlogDriveroptionalLogDriverLogDriveroptionalLogDriverLogDriveroptionalLogDriver#Default: AwsLogDriver if enableLogging is true
memoryLimitMiBoptionalnumbermemory_limit_mi_boptionalint | floatmemoryLimitMiBoptionalNumberMemoryLimitMiBoptionaldoubleMemoryLimitMiBoptional*float64#Default: No memory limit.
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.
memoryReservationMiBoptionalnumbermemory_reservation_mi_boptionalint | floatmemoryReservationMiBoptionalNumberMemoryReservationMiBoptionaldoubleMemoryReservationMiBoptional*float64#Default: No memory reserved.
notes
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.