aws-cdk-lib.aws_ecs_patterns.ScheduledEc2TaskImageOptions

interface ScheduledEc2TaskImageOptions

LanguageType name
.NETAmazon.CDK.AWS.ECS.Patterns.ScheduledEc2TaskImageOptions
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsecspatterns#ScheduledEc2TaskImageOptions
Javasoftware.amazon.awscdk.services.ecs.patterns.ScheduledEc2TaskImageOptions
Pythonaws_cdk.aws_ecs_patterns.ScheduledEc2TaskImageOptions
TypeScript (source)aws-cdk-lib » aws_ecs_patterns » ScheduledEc2TaskImageOptions

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

NameTypeDescription
imageContainerImageThe image used to start a container.
command?string[]The command that is passed to the container.
cpu?numberThe minimum number of CPU units to reserve for the container.
environment?{ [string]: string }The environment variables to pass to the container.
logDriver?LogDriverThe log driver to use.
memoryLimitMiB?numberThe hard limit (in MiB) of memory to present to the container.
memoryReservationMiB?numberThe soft limit (in MiB) of memory to reserve for the container.
secrets?{ [string]: Secret }The secret to expose to the container as an environment variable.

image

Type: ContainerImage

The image used to start a container.

Image or taskDefinition must be specified, but not both.


command?

Type: string[] (optional, default: CMD value built into container image.)

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.


cpu?

Type: number (optional, default: none)

The minimum number of CPU units to reserve for the container.


environment?

Type: { [string]: string } (optional, default: none)

The environment variables to pass to the container.


logDriver?

Type: LogDriver (optional, default: AwsLogDriver if enableLogging is true)

The log driver to use.


memoryLimitMiB?

Type: number (optional, default: No memory limit.)

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.


memoryReservationMiB?

Type: number (optional, default: No memory reserved.)

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.


secrets?

Type: { [string]: Secret } (optional, default: No secret environment variables.)

The secret to expose to the container as an environment variable.