AmazonLinux2Kernel

class aws_cdk.aws_ec2.AmazonLinux2Kernel(version)

Bases: object

Amazon Linux 2 kernel versions.

ExampleMetadata:

infused

Example:

# vpc: ec2.Vpc
# instance_type: ec2.InstanceType


# Amazon Linux 2
ec2.Instance(self, "Instance2",
    vpc=vpc,
    instance_type=instance_type,
    machine_image=ec2.MachineImage.latest_amazon_linux2()
)

# Amazon Linux 2 with kernel 5.x
ec2.Instance(self, "Instance3",
    vpc=vpc,
    instance_type=instance_type,
    machine_image=ec2.MachineImage.latest_amazon_linux2(
        kernel=ec2.AmazonLinux2Kernel.KERNEL_5_10
    )
)

# Amazon Linux 2023
ec2.Instance(self, "Instance4",
    vpc=vpc,
    instance_type=instance_type,
    machine_image=ec2.MachineImage.latest_amazon_linux2023()
)

# Graviton 3 Processor
ec2.Instance(self, "Instance5",
    vpc=vpc,
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
    machine_image=ec2.MachineImage.latest_amazon_linux2023(
        cpu_type=ec2.AmazonLinuxCpuType.ARM_64
    )
)
Parameters:

version (str) –

Methods

to_string()

Generate a string representation of the kernel.

Return type:

Optional[str]

Attributes

CDK_LATEST = <aws_cdk.aws_ec2.AmazonLinux2Kernel object>
DEFAULT = <aws_cdk.aws_ec2.AmazonLinux2Kernel object>
KERNEL_5_10 = <aws_cdk.aws_ec2.AmazonLinux2Kernel object>