# LaunchTemplateCpuOptions

The CPU options for the instance.

- Source: [`aws-ec2/lib/launch-template.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ec2/lib/launch-template.ts#L227)
- Type last changed: v2.268.0 · 2 Sep 2026

## Example

TypeScript:

```ts
new ec2.LaunchTemplate(this, 'LaunchTemplate', {
  machineImage: ec2.MachineImage.latestAmazonLinux2023(),
  cpuOptions: {
    coreCount: 4,
    threadsPerCore: 1,
    nestedVirtualization: true,
  },
});
```

Python:

```python
ec2.LaunchTemplate(self, "LaunchTemplate",
    machine_image=ec2.MachineImage.latest_amazon_linux2023(),
    cpu_options=ec2.LaunchTemplateCpuOptions(
        core_count=4,
        threads_per_core=1,
        nested_virtualization=True
    )
)
```

Java:

```java
LaunchTemplate.Builder.create(this, "LaunchTemplate")
        .machineImage(MachineImage.latestAmazonLinux2023())
        .cpuOptions(LaunchTemplateCpuOptions.builder()
                .coreCount(4)
                .threadsPerCore(1)
                .nestedVirtualization(true)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
new LaunchTemplate(this, "LaunchTemplate", new LaunchTemplateProps {
    MachineImage = MachineImage.LatestAmazonLinux2023(),
    CpuOptions = new LaunchTemplateCpuOptions {
        CoreCount = 4,
        ThreadsPerCore = 1,
        NestedVirtualization = true
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
ec2.NewLaunchTemplate(this, jsii.String("LaunchTemplate"), &LaunchTemplateProps{
	MachineImage: ec2.MachineImage_LatestAmazonLinux2023(),
	CpuOptions: &LaunchTemplateCpuOptions{
		CoreCount: jsii.Number(4),
		ThreadsPerCore: jsii.Number(1),
		NestedVirtualization: jsii.Boolean(true),
	},
})
```

## Properties

- `amdSevSnp`: boolean — Indicates whether to enable the instance for AMD SEV-SNP.

  **Default:** AMD SEV-SNP is not specified in the launch template.

  AMD SEV-SNP is supported with M6a, R6a, and C6a instance types only.

- `coreCount`: number — The number of CPU cores for the instance.

  **Default:** The default number of CPU cores for the selected instance type.

- `nestedVirtualization`: boolean — Indicates whether the instance is enabled for nested virtualization.

  **Default:** Nested virtualization is not specified in the launch template.

- `threadsPerCore`: number — The number of threads per CPU core.

  **Default:** The default number of threads per core for the selected instance type.

  To disable multithreading for the instance, specify a value of 1.
  Otherwise, specify the default value of 2.
