# AmazonLinux2Kernel

Amazon Linux 2 kernel versions.

- Source: [`aws-ec2/lib/machine-image/amazon-linux2.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-ec2/lib/machine-image/amazon-linux2.ts#L7)
- Type last changed: v2.76.0 · 20 Apr 2023

## Example

```ts
declare const vpc: ec2.Vpc;
declare const instanceType: ec2.InstanceType;

// Amazon Linux 2
new ec2.Instance(this, 'Instance2', {
  vpc,
  instanceType,
  machineImage: ec2.MachineImage.latestAmazonLinux2(),
});

// Amazon Linux 2 with kernel 5.x
new ec2.Instance(this, 'Instance3', {
  vpc,
  instanceType,
  machineImage: ec2.MachineImage.latestAmazonLinux2({
    kernel: ec2.AmazonLinux2Kernel.KERNEL_5_10,
  }),
});

// Amazon Linux 2023
new ec2.Instance(this, 'Instance4', {
  vpc,
  instanceType,
  machineImage: ec2.MachineImage.latestAmazonLinux2023(),
});

// Graviton 3 Processor
new ec2.Instance(this, 'Instance5', {
  vpc,
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE),
  machineImage: ec2.MachineImage.latestAmazonLinux2023({
    cpuType: ec2.AmazonLinuxCpuType.ARM_64,
  }),
});
```

## Initializer

```ts
new AmazonLinux2Kernel(version: string)
```

## Properties

- `CDK_LATEST`: [AmazonLinux2Kernel](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.AmazonLinux2Kernel.html) (static) — The latest kernel version currently available in a published AMI.

  When a new kernel version is available for an amzn2 AMI this will be
  updated to contain the latest kernel version and will cause your instances
  to be replaced. Do not store stateful information on the instance if you are
  using this version.

- `DEFAULT`: [AmazonLinux2Kernel](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.AmazonLinux2Kernel.html) (static) — The default kernel version for Amazon Linux 2 is 4.14 and Linux 4.14.311-233.529.amzn2.x86_64 the SSM parameter does not include it in the name (i.e. /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2).

- `KERNEL_5_10`: [AmazonLinux2Kernel](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.AmazonLinux2Kernel.html) (static) — Kernel version 5.10.

## Methods

- `toString(): string` — Generate a string representation of the kernel.
