# InstanceType

Instance type for EC2 instances.

This class takes a literal string, good if you already
know the identifier of the type you want.

Extends: InstanceType
Superclass of: OptimalInstanceType

- Source: [`aws-ec2/lib/instance-types.ts`](https://github.com/aws/aws-cdk/blob/v2.273.0/packages/aws-cdk-lib/aws-ec2/lib/instance-types.ts#L1843)
- Type last changed: v2.131.0 · 1 Mar 2024

## Example

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

const cluster = new docdb.DatabaseCluster(this, 'Database', {
  masterUser: {
    username: 'myuser',
  },
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.MEMORY5, ec2.InstanceSize.LARGE),
  vpcSubnets: {
    subnetType: ec2.SubnetType.PUBLIC,
  },
  vpc,
  removalPolicy: RemovalPolicy.SNAPSHOT,
});
```

## Initializer

```ts
new InstanceType(instanceTypeIdentifier: string)
```

## Properties

- `architecture`: [InstanceArchitecture](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.InstanceArchitecture.html) (required) — The instance's CPU architecture.

## Methods

- `isBurstable(): boolean` — Return whether this instance type is a burstable instance type.

- `of(instanceClass: InstanceClass, instanceSize: InstanceSize): InstanceType // chainable` (static) — Instance type for EC2 instances.

  This class takes a combination of a class and size.

  Be aware that not all combinations of class and size are available, and not all
  classes are available in all regions.

- `sameInstanceClassAs(other: InstanceType): boolean`

- `toString(): string` — Return the instance type as a dotted string.
