Skip to content
v2.274.0

ScheduledEc2TaskImageOptions Struct ​

The properties for the ScheduledEc2Task using an image.

Example ​

ts
// 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#
The command that is passed to the container.

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#
Optional name for the container added.
cpuoptionalnumbercpuoptionalint | floatcpuoptionalNumberCpuoptionaldoubleCpuoptional*float64= none#
The minimum number of CPU units to reserve for the container.
environmentoptional{ [key: string]: string }environmentoptionaltyping.Mapping[str, str]environmentoptionalMap<String, String>EnvironmentoptionalIDictionary<string, string>Environmentoptional*map[string]*string= none#
The environment variables to pass to the container.
The image used to start a container.

Image or taskDefinition must be specified, but not both.

logDriveroptionalLogDriverlog_driveroptionalLogDriverlogDriveroptionalLogDriverLogDriveroptionalLogDriverLogDriveroptionalLogDriver#
The log driver to use.

Default: AwsLogDriver if enableLogging is true

memoryLimitMiBoptionalnumbermemory_limit_mi_boptionalint | floatmemoryLimitMiBoptionalNumberMemoryLimitMiBoptionaldoubleMemoryLimitMiBoptional*float64#
The hard limit (in MiB) of memory to present to the container.

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#
The soft limit (in MiB) of memory to reserve for the container.

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.

secretsoptional{ [key: string]: Secret }secretsoptionaltyping.Mapping[str, Secret]secretsoptionalMap<String, Secret>SecretsoptionalIDictionary<string, Secret>Secretsoptional*map[string]Secret#
The secret to expose to the container as an environment variable.

Default: No secret environment variables.