MachineImageType

class aws_cdk.aws_ecs.MachineImageType(value)

Bases: Enum

The machine image type.

ExampleMetadata:

infused

Example:

# vpc: ec2.Vpc

launch_template = ec2.LaunchTemplate(self, "ASG-LaunchTemplate",
    instance_type=ec2.InstanceType("t3.medium"),
    machine_image=ecs.EcsOptimizedImage.amazon_linux2(),
    user_data=ec2.UserData.for_linux()
)

auto_scaling_group = autoscaling.AutoScalingGroup(self, "ASG",
    vpc=vpc,
    mixed_instances_policy=autoscaling.MixedInstancesPolicy(
        instances_distribution=autoscaling.InstancesDistribution(
            on_demand_percentage_above_base_capacity=50
        ),
        launch_template=launch_template
    )
)

cluster = ecs.Cluster(self, "Cluster", vpc=vpc)

capacity_provider = ecs.AsgCapacityProvider(self, "AsgCapacityProvider",
    auto_scaling_group=auto_scaling_group,
    machine_image_type=ecs.MachineImageType.AMAZON_LINUX_2
)

cluster.add_asg_capacity_provider(capacity_provider)

Attributes

AMAZON_LINUX_2

Amazon ECS-optimized Amazon Linux 2 AMI.

BOTTLEROCKET

Bottlerocket AMI.