Compatibility
- class aws_cdk.aws_ecs.Compatibility(*values)
Bases:
EnumThe task launch type compatibility requirement.
- 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 ) # Use custom() option - specify custom capacity provider strategy run_task_with_custom = tasks.EcsRunTask(self, "RunTaskWithCustom", cluster=cluster, task_definition=task_definition, launch_target=tasks.EcsFargateLaunchTarget( platform_version=ecs.FargatePlatformVersion.VERSION1_4, capacity_provider_options=tasks.CapacityProviderOptions.custom([capacity_provider="FARGATE_SPOT", weight=2, base=1, capacity_provider="FARGATE", weight=1 ]) ) ) # Use default() option - uses cluster's default capacity provider strategy run_task_with_default = tasks.EcsRunTask(self, "RunTaskWithDefault", cluster=cluster, task_definition=task_definition, launch_target=tasks.EcsFargateLaunchTarget( platform_version=ecs.FargatePlatformVersion.VERSION1_4, capacity_provider_options=tasks.CapacityProviderOptions.default() ) )
Attributes
- EC2
The task should specify the EC2 launch type.
- EC2_AND_FARGATE
The task can specify either the EC2 or Fargate launch types.
- EC2_AND_MANAGED_INSTANCES
The task can specify either the EC2 or Managed Instances launch types.
- EXTERNAL
The task should specify the External launch type.
- FARGATE
The task should specify the Fargate launch type.
- FARGATE_AND_EC2_AND_MANAGED_INSTANCES
The task can specify either the Fargate, EC2 or Managed Instances launch types.
- FARGATE_AND_MANAGED_INSTANCES
The task can specify either the Fargate or Managed Instances launch types.
- MANAGED_INSTANCES
The task should specify the Managed Instances launch type.