LocalStorage

class aws_cdk.aws_ec2.LocalStorage(*values)

Bases: Enum

Local storage support requirements for EC2 instances.

Controls whether selected instance types must, may, or must not include directly attached local storage (instance store).

ExampleMetadata:

infused

Example:

# infrastructure_role: iam.Role
# instance_profile: iam.InstanceProfile
# vpc: ec2.Vpc


mi_capacity_provider = ecs.ManagedInstancesCapacityProvider(self, "MICapacityProvider",
    infrastructure_role=infrastructure_role,
    ec2_instance_profile=instance_profile,
    subnets=vpc.private_subnets,
    instance_requirements=ec2.InstanceRequirementsConfig(
        # Required: CPU and memory constraints
        v_cpu_count_min=2,
        v_cpu_count_max=8,
        memory_min=Size.gibibytes(4),
        memory_max=Size.gibibytes(32),

        # CPU preferences
        cpu_manufacturers=[ec2.CpuManufacturer.INTEL, ec2.CpuManufacturer.AMD],
        instance_generations=[ec2.InstanceGeneration.CURRENT],

        # Instance type filtering
        allowed_instance_types=["m5.*", "c5.*"],

        # Performance characteristics
        burstable_performance=ec2.BurstablePerformance.EXCLUDED,
        bare_metal=ec2.BareMetal.EXCLUDED,

        # Accelerator requirements (for ML/AI workloads)
        accelerator_types=[ec2.AcceleratorType.GPU],
        accelerator_manufacturers=[ec2.AcceleratorManufacturer.NVIDIA],
        accelerator_names=[ec2.AcceleratorName.T4, ec2.AcceleratorName.V100],
        accelerator_count_min=1,

        # Storage requirements
        local_storage=ec2.LocalStorage.REQUIRED,
        local_storage_types=[ec2.LocalStorageType.SSD],
        total_local_storage_gBMin=100,

        # Network requirements
        network_interface_count_min=2,
        network_bandwidth_gbps_min=10,

        # Cost optimization
        on_demand_max_price_percentage_over_lowest_price=10
    )
)

Attributes

EXCLUDED

Instance types with local storage are disallowed.

Only types without local storage may be selected.

INCLUDED

Instance types with local storage are allowed, but types without local storage may also be selected.

REQUIRED

Only instance types with local storage are allowed.

Types without local storage will be excluded.