class ScheduledFargateTask (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ECS.Patterns.ScheduledFargateTask |
Java | software.amazon.awscdk.services.ecs.patterns.ScheduledFargateTask |
Python | aws_cdk.aws_ecs_patterns.ScheduledFargateTask |
TypeScript (source) | @aws-cdk/aws-ecs-patterns » ScheduledFargateTask |
Implements
IConstruct
, IConstruct
, IDependable
A scheduled Fargate task that will be initiated off of CloudWatch Events.
Example
declare const cluster: ecs.Cluster;
const scheduledFargateTask = new ecsPatterns.ScheduledFargateTask(this, 'ScheduledFargateTask', {
cluster,
scheduledFargateTaskImageOptions: {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
memoryLimitMiB: 512,
},
schedule: appscaling.Schedule.expression('rate(1 minute)'),
platformVersion: ecs.FargatePlatformVersion.LATEST,
});
Initializer
new ScheduledFargateTask(scope: Construct, id: string, props: ScheduledFargateTaskProps)
Parameters
- scope
Construct
- id
string
- props
Scheduled
Fargate Task Props
Constructs a new instance of the ScheduledFargateTask class.
Construct Props
Name | Type | Description |
---|---|---|
schedule | Schedule | The schedule or rate (frequency) that determines when CloudWatch Events runs the rule. |
cluster? | ICluster | The name of the cluster that hosts the service. |
desired | number | The desired number of instantiations of the task definition to keep running on the service. |
enabled? | boolean | Indicates whether the rule is enabled. |
platform | Fargate | The platform version on which to run your service. |
rule | string | A name for the rule. |
scheduled | Scheduled | The properties to define if using an existing TaskDefinition in this construct. |
scheduled | Scheduled | The properties to define if the construct is to create a TaskDefinition. |
security | ISecurity [] | Existing security groups to use for your service. |
subnet | Subnet | In what subnets to place the task's ENIs. |
vpc? | IVpc | The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed. |
schedule
Type:
Schedule
The schedule or rate (frequency) that determines when CloudWatch Events runs the rule.
For more information, see Schedule Expression Syntax for Rules in the Amazon CloudWatch User Guide.
cluster?
Type:
ICluster
(optional, default: create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you.)
The name of the cluster that hosts the service.
If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc.
desiredTaskCount?
Type:
number
(optional, default: 1)
The desired number of instantiations of the task definition to keep running on the service.
enabled?
Type:
boolean
(optional, default: true)
Indicates whether the rule is enabled.
platformVersion?
Type:
Fargate
(optional, default: Latest)
The platform version on which to run your service.
If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide.
ruleName?
Type:
string
(optional, default: AWS CloudFormation generates a unique physical ID and uses that ID
for the rule name. For more information, see Name Type.)
A name for the rule.
scheduledFargateTaskDefinitionOptions?
Type:
Scheduled
(optional, default: none)
The properties to define if using an existing TaskDefinition in this construct.
ScheduledFargateTaskDefinitionOptions or ScheduledFargateTaskImageOptions must be defined, but not both.
scheduledFargateTaskImageOptions?
Type:
Scheduled
(optional, default: none)
The properties to define if the construct is to create a TaskDefinition.
ScheduledFargateTaskDefinitionOptions or ScheduledFargateTaskImageOptions must be defined, but not both.
securityGroups?
Type:
ISecurity
[]
(optional, default: a new security group will be created.)
Existing security groups to use for your service.
subnetSelection?
Type:
Subnet
(optional, default: Private subnets)
In what subnets to place the task's ENIs.
(Only applicable in case the TaskDefinition is configured for AwsVpc networking)
vpc?
Type:
IVpc
(optional, default: uses the VPC defined in the cluster or creates a new VPC.)
The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed.
If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster.
Properties
Name | Type | Description |
---|---|---|
cluster | ICluster | The name of the cluster that hosts the service. |
desired | number | The desired number of instantiations of the task definition to keep running on the service. |
event | Rule | The CloudWatch Events rule for the service. |
node | Construct | The construct tree node associated with this construct. |
subnet | Subnet | In what subnets to place the task's ENIs. |
task | Ecs | The ECS task in this construct. |
task | Fargate | The Fargate task definition in this construct. |
cluster
Type:
ICluster
The name of the cluster that hosts the service.
desiredTaskCount
Type:
number
The desired number of instantiations of the task definition to keep running on the service.
The minimum value is 1
eventRule
Type:
Rule
The CloudWatch Events rule for the service.
node
Type:
Construct
The construct tree node associated with this construct.
subnetSelection
Type:
Subnet
In what subnets to place the task's ENIs.
(Only applicable in case the TaskDefinition is configured for AwsVpc networking)
task
Type:
Ecs
The ECS task in this construct.
taskDefinition
Type:
Fargate
The Fargate task definition in this construct.
Methods
Name | Description |
---|---|
to | Returns a string representation of this construct. |
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.