EcsFargateLaunchTarget
- class aws_cdk.aws_stepfunctions_tasks.EcsFargateLaunchTarget(*, platform_version, capacity_provider_options=None)
Bases:
objectConfiguration for running an ECS task on Fargate.
- See:
- ExampleMetadata:
infused
Example:
vpc = ec2.Vpc.from_lookup(self, "Vpc", is_default=True ) cluster = ecs.Cluster(self, "FargateCluster", vpc=vpc) task_definition = ecs.TaskDefinition(self, "TD", memory_mi_b="512", cpu="256", compatibility=ecs.Compatibility.FARGATE ) container_definition = task_definition.add_container("TheContainer", image=ecs.ContainerImage.from_registry("foo/bar"), memory_limit_mi_b=256 ) run_task = tasks.EcsRunTask(self, "RunFargate", integration_pattern=sfn.IntegrationPattern.RUN_JOB, cluster=cluster, task_definition=task_definition, assign_public_ip=True, container_overrides=[tasks.ContainerOverride( container_definition=container_definition, environment=[tasks.TaskEnvironmentVariable(name="SOME_KEY", value=sfn.JsonPath.string_at("$.SomeKey"))] )], launch_target=tasks.EcsFargateLaunchTarget(), propagated_tag_source=ecs.PropagatedTagSource.TASK_DEFINITION )
- Parameters:
platform_version (
FargatePlatformVersion) – Refers to a specific runtime environment for Fargate task infrastructure. Fargate platform version is a combination of the kernel and container runtime versions.capacity_provider_options (
Optional[CapacityProviderOptions]) – The capacity provider options to use for the task. This property allows you to set the capacity provider strategy for the task. If you want to set the capacity provider strategy for the task, specifyCapacityProviderOptions.custom(). This is required to use the FARGATE_SPOT capacity provider. If you want to use the cluster’s default capacity provider strategy, specifyCapacityProviderOptions.default(). Default: - ‘FARGATE’ LaunchType running tasks on AWS Fargate On-Demand infrastructure is used without the capacity provider strategy.
Methods
- bind(task, *, task_definition, cluster=None)
Called when the Fargate launch type configured on RunTask.
- Parameters:
task (
EcsRunTask)task_definition (
ITaskDefinition) – Task definition to run Docker containers in Amazon ECS.cluster (
Optional[ICluster]) – A regional grouping of one or more container instances on which you can run tasks and services. Default: - No cluster
- Return type: