Skip to content
v2.277.0

CommonEcsRunTaskProps Struct ​

Basic properties for ECS Tasks.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';
import { aws_stepfunctions as stepfunctions } from 'aws-cdk-lib';
import { aws_stepfunctions_tasks as stepfunctions_tasks } from 'aws-cdk-lib';

declare const cluster: ecs.Cluster;
declare const containerDefinition: ecs.ContainerDefinition;
declare const taskDefinition: ecs.TaskDefinition;
const commonEcsRunTaskProps: stepfunctions_tasks.CommonEcsRunTaskProps = {
  cluster: cluster,
  taskDefinition: taskDefinition,

  // the properties below are optional
  containerOverrides: [{
    containerDefinition: containerDefinition,

    // the properties below are optional
    command: ['command'],
    cpu: 123,
    environment: [{
      name: 'name',
      value: 'value',
    }],
    memoryLimit: 123,
    memoryReservation: 123,
  }],
  integrationPattern: stepfunctions.ServiceIntegrationPattern.FIRE_AND_FORGET,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ecs as ecs
from aws_cdk import aws_stepfunctions as stepfunctions
from aws_cdk import aws_stepfunctions_tasks as stepfunctions_tasks

# cluster: ecs.Cluster
# container_definition: ecs.ContainerDefinition
# task_definition: ecs.TaskDefinition

common_ecs_run_task_props = stepfunctions_tasks.CommonEcsRunTaskProps(
    cluster=cluster,
    task_definition=task_definition,

    # the properties below are optional
    container_overrides=[stepfunctions_tasks.ContainerOverride(
        container_definition=container_definition,

        # the properties below are optional
        command=["command"],
        cpu=123,
        environment=[stepfunctions_tasks.TaskEnvironmentVariable(
            name="name",
            value="value"
        )],
        memory_limit=123,
        memory_reservation=123
    )],
    integration_pattern=stepfunctions.ServiceIntegrationPattern.FIRE_AND_FORGET
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ecs.*;
import software.amazon.awscdk.services.stepfunctions.*;
import software.amazon.awscdk.services.stepfunctions.tasks.*;

Cluster cluster;
ContainerDefinition containerDefinition;
TaskDefinition taskDefinition;

CommonEcsRunTaskProps commonEcsRunTaskProps = CommonEcsRunTaskProps.builder()
        .cluster(cluster)
        .taskDefinition(taskDefinition)

        // the properties below are optional
        .containerOverrides(List.of(ContainerOverride.builder()
                .containerDefinition(containerDefinition)

                // the properties below are optional
                .command(List.of("command"))
                .cpu(123)
                .environment(List.of(TaskEnvironmentVariable.builder()
                        .name("name")
                        .value("value")
                        .build()))
                .memoryLimit(123)
                .memoryReservation(123)
                .build()))
        .integrationPattern(ServiceIntegrationPattern.FIRE_AND_FORGET)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ECS;
using Amazon.CDK.AWS.StepFunctions;
using Amazon.CDK.AWS.StepFunctions.Tasks;

Cluster cluster;
ContainerDefinition containerDefinition;
TaskDefinition taskDefinition;

var commonEcsRunTaskProps = new CommonEcsRunTaskProps {
    Cluster = cluster,
    TaskDefinition = taskDefinition,

    // the properties below are optional
    ContainerOverrides = new [] { new ContainerOverride {
        ContainerDefinition = containerDefinition,

        // the properties below are optional
        Command = new [] { "command" },
        Cpu = 123,
        Environment = new [] { new TaskEnvironmentVariable {
            Name = "name",
            Value = "value"
        } },
        MemoryLimit = 123,
        MemoryReservation = 123
    } },
    IntegrationPattern = ServiceIntegrationPattern.FIRE_AND_FORGET
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var cluster Cluster
var containerDefinition ContainerDefinition
var taskDefinition TaskDefinition

commonEcsRunTaskProps := &CommonEcsRunTaskProps{
	Cluster: cluster,
	TaskDefinition: taskDefinition,

	// the properties below are optional
	ContainerOverrides: []ContainerOverride{
		&ContainerOverride{
			ContainerDefinition: containerDefinition,

			// the properties below are optional
			Command: []*string{
				jsii.String("command"),
			},
			Cpu: jsii.Number(123),
			Environment: []TaskEnvironmentVariable{
				&TaskEnvironmentVariable{
					Name: jsii.String("name"),
					Value: jsii.String("value"),
				},
			},
			MemoryLimit: jsii.Number(123),
			MemoryReservation: jsii.Number(123),
		},
	},
	IntegrationPattern: awscdk.Aws_stepfunctions.ServiceIntegrationPattern_FIRE_AND_FORGET,
}

Properties ​

clusterIClusterclusterIClusterclusterIClusterClusterIClusterClusterICluster required #
The topic to run the task on.
containerOverridesoptionalContainerOverride[]container_overridesoptionaltyping.List[ContainerOverride]containerOverridesoptionalList<ContainerOverride>ContainerOverridesoptionalContainerOverride[]ContainerOverridesoptional*[]ContainerOverride #
Container setting overrides.

Default: No overrides

Key is the name of the container to override, value is the values you want to override.

integrationPatternoptionalServiceIntegrationPatternintegration_patternoptionalServiceIntegrationPatternintegrationPatternoptionalServiceIntegrationPatternIntegrationPatternoptionalServiceIntegrationPatternIntegrationPatternoptionalServiceIntegrationPattern = FIRE_AND_FORGET #
The service integration pattern indicates different ways to call RunTask in ECS.

The valid value for Lambda is FIRE_AND_FORGET, SYNC and WAIT_FOR_TASK_TOKEN.

taskDefinitionTaskDefinitiontask_definitionTaskDefinitiontaskDefinitionTaskDefinitionTaskDefinitionTaskDefinitionTaskDefinitionTaskDefinition required #
Task Definition used for running tasks in the service.

Note: this must be TaskDefinition, and not ITaskDefinition, as it requires properties that are not known for imported task definitions If you want to run a RunTask with an imported task definition, consider using CustomState