# ComputeConfiguration

The compute configuration for the fleet.

- Source: [`aws-codebuild/lib/fleet.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-codebuild/lib/fleet.ts#L135)
- Type last changed: v2.219.0 · 1 Oct 2025

## Example

TypeScript:

```ts
import { Size } from 'aws-cdk-lib';

const fleet = new codebuild.Fleet(this, 'MyFleet', {
  baseCapacity: 1,
  computeType: codebuild.FleetComputeType.ATTRIBUTE_BASED,
  environmentType: codebuild.EnvironmentType.LINUX_CONTAINER,
  computeConfiguration: {
    vCpu: 2,
    memory: Size.gibibytes(4),
    disk: Size.gibibytes(10),
    machineType: codebuild.MachineType.GENERAL,
  },
});
```

Python:

```python
from aws_cdk import Size

fleet = codebuild.Fleet(self, "MyFleet",
    base_capacity=1,
    compute_type=codebuild.FleetComputeType.ATTRIBUTE_BASED,
    environment_type=codebuild.EnvironmentType.LINUX_CONTAINER,
    compute_configuration=codebuild.ComputeConfiguration(
        v_cpu=2,
        memory=Size.gibibytes(4),
        disk=Size.gibibytes(10),
        machine_type=codebuild.MachineType.GENERAL
    )
)
```

Java:

```java
import software.amazon.awscdk.Size;

Fleet fleet = Fleet.Builder.create(this, "MyFleet")
        .baseCapacity(1)
        .computeType(FleetComputeType.ATTRIBUTE_BASED)
        .environmentType(EnvironmentType.LINUX_CONTAINER)
        .computeConfiguration(ComputeConfiguration.builder()
                .vCpu(2)
                .memory(Size.gibibytes(4))
                .disk(Size.gibibytes(10))
                .machineType(MachineType.GENERAL)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK;

var fleet = new Fleet(this, "MyFleet", new FleetProps {
    BaseCapacity = 1,
    ComputeType = FleetComputeType.ATTRIBUTE_BASED,
    EnvironmentType = EnvironmentType.LINUX_CONTAINER,
    ComputeConfiguration = new ComputeConfiguration {
        VCpu = 2,
        Memory = Size.Gibibytes(4),
        Disk = Size.Gibibytes(10),
        MachineType = MachineType.GENERAL
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"

fleet := codebuild.NewFleet(this, jsii.String("MyFleet"), &FleetProps{
	BaseCapacity: jsii.Number(1),
	ComputeType: codebuild.FleetComputeType_ATTRIBUTE_BASED,
	EnvironmentType: codebuild.EnvironmentType_LINUX_CONTAINER,
	ComputeConfiguration: &ComputeConfiguration{
		VCpu: jsii.Number(2),
		Memory: awscdk.Size_Gibibytes(jsii.Number(4)),
		Disk: awscdk.Size_*Gibibytes(jsii.Number(10)),
		MachineType: codebuild.MachineType_GENERAL,
	},
})
```

## Properties

- `disk`: [Size](/cdk/api/v2/docs/aws-cdk-lib.Size.html) — When using ATTRIBUTE_BASED, the amount of disk space of the instance type included in your fleet.

  **Default:** No requirement, the actual value will be based on the other selected configuration properties

  When using CUSTOM_INSTANCE_TYPE,
  the additional amount of disk space to provision over the 64GB included by
  default.

- `instanceType`: [InstanceType](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.InstanceType.html) = none — When using CUSTOM_INSTANCE_TYPE, the EC2 instance type to use for fleet instances.

  Not all instance types are supported by CodeBuild. If you use a disallowed type, the
  CloudFormation deployment will fail.

- `machineType`: [MachineType](/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild.MachineType.html) — When using ATTRIBUTE_BASED, the machine type of the instance type included in your fleet.

  **Default:** No requirement, the actual value will be based on the other selected configuration properties

- `memory`: [Size](/cdk/api/v2/docs/aws-cdk-lib.Size.html) — When using ATTRIBUTE_BASED, the amount of memory of the instance type included in your fleet.

  **Default:** No requirement, the actual value will be based on the other selected configuration properties

- `vCpu`: number — When using ATTRIBUTE_BASED, the number of vCPUs of the instance type included in your fleet.

  **Default:** No requirement, the actual value will be based on the other selected configuration properties
