Class ScheduledEc2TaskImageOptions
The properties for the ScheduledEc2Task using an image.
Inheritance
Namespace: Amazon.CDK.AWS.ECS.Patterns
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ScheduledEc2TaskImageOptions : Object, IScheduledEc2TaskImageOptions, IScheduledTaskImageProps
Syntax (vb)
Public Class ScheduledEc2TaskImageOptions
Inherits Object
Implements IScheduledEc2TaskImageOptions, IScheduledTaskImageProps
Remarks
ExampleMetadata: infused
Examples
// Instantiate an Amazon EC2 Task to run at a scheduled interval
Cluster cluster;
var ecsScheduledTask = new ScheduledEc2Task(this, "ScheduledTask", new ScheduledEc2TaskProps {
Cluster = cluster,
ScheduledEc2TaskImageOptions = new ScheduledEc2TaskImageOptions {
Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample"),
MemoryLimitMiB = 256,
Environment = new Dictionary<string, string> { { "name", "TRIGGER" }, { "value", "CloudWatch Events" } }
},
Schedule = Schedule.Expression("rate(1 minute)"),
Enabled = true,
RuleName = "sample-scheduled-task-rule"
});
Synopsis
Constructors
ScheduledEc2TaskImageOptions() |
Properties
Command | The command that is passed to the container. |
Cpu | The minimum number of CPU units to reserve for the container. |
Environment | The environment variables to pass to the container. |
Image | The image used to start a container. |
LogDriver | The log driver to use. |
MemoryLimitMiB | The hard limit (in MiB) of memory to present to the container. |
MemoryReservationMiB | The soft limit (in MiB) of memory to reserve for the container. |
Secrets | The secret to expose to the container as an environment variable. |
Constructors
ScheduledEc2TaskImageOptions()
public ScheduledEc2TaskImageOptions()
Properties
Command
The command that is passed to the container.
public string[] Command { get; set; }
Property Value
System.String[]
Remarks
If you provide a shell command as a single string, you have to quote command-line arguments.
Default: - CMD value built into container image.
Cpu
The minimum number of CPU units to reserve for the container.
public Nullable<double> Cpu { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Default: none
Environment
The environment variables to pass to the container.
public IDictionary<string, string> Environment { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String>
Remarks
Default: none
Image
The image used to start a container.
public ContainerImage Image { get; set; }
Property Value
Remarks
Image or taskDefinition must be specified, but not both.
Default: - none
LogDriver
The log driver to use.
public LogDriver LogDriver { get; set; }
Property Value
Remarks
Default: - AwsLogDriver if enableLogging is true
MemoryLimitMiB
The hard limit (in MiB) of memory to present to the container.
public Nullable<double> MemoryLimitMiB { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
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.
MemoryReservationMiB
The soft limit (in MiB) of memory to reserve for the container.
public Nullable<double> MemoryReservationMiB { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
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.
public IDictionary<string, Secret> Secrets { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, Secret>
Remarks
Default: - No secret environment variables.