# FleetProps

Construction properties of a CodeBuild Fleet.

Used as props by: [Fleet](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild.Fleet.html)

- 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#L18)
- 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.CUSTOM_INSTANCE_TYPE,
  environmentType: codebuild.EnvironmentType.LINUX_CONTAINER,
  computeConfiguration: {
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MEDIUM),
    // By default, 64 GiB of disk space is included. Any value optionally
    // specified here is _incremental_ on top of the included disk space.
    disk: Size.gibibytes(10),
  },
});
```

Python:

```python
from aws_cdk import Size

fleet = codebuild.Fleet(self, "MyFleet",
    base_capacity=1,
    compute_type=codebuild.FleetComputeType.CUSTOM_INSTANCE_TYPE,
    environment_type=codebuild.EnvironmentType.LINUX_CONTAINER,
    compute_configuration=codebuild.ComputeConfiguration(
        instance_type=ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MEDIUM),
        # By default, 64 GiB of disk space is included. Any value optionally
        # specified here is _incremental_ on top of the included disk space.
        disk=Size.gibibytes(10)
    )
)
```

Java:

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

Fleet fleet = Fleet.Builder.create(this, "MyFleet")
        .baseCapacity(1)
        .computeType(FleetComputeType.CUSTOM_INSTANCE_TYPE)
        .environmentType(EnvironmentType.LINUX_CONTAINER)
        .computeConfiguration(ComputeConfiguration.builder()
                .instanceType(InstanceType.of(InstanceClass.T3, InstanceSize.MEDIUM))
                // By default, 64 GiB of disk space is included. Any value optionally
                // specified here is _incremental_ on top of the included disk space.
                .disk(Size.gibibytes(10))
                .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.CUSTOM_INSTANCE_TYPE,
    EnvironmentType = EnvironmentType.LINUX_CONTAINER,
    ComputeConfiguration = new ComputeConfiguration {
        InstanceType = InstanceType.Of(InstanceClass.T3, InstanceSize.MEDIUM),
        // By default, 64 GiB of disk space is included. Any value optionally
        // specified here is _incremental_ on top of the included disk space.
        Disk = Size.Gibibytes(10)
    }
});
```

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_CUSTOM_INSTANCE_TYPE,
	EnvironmentType: codebuild.EnvironmentType_LINUX_CONTAINER,
	ComputeConfiguration: &ComputeConfiguration{
		InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_T3, ec2.InstanceSize_MEDIUM),
		// By default, 64 GiB of disk space is included. Any value optionally
		// specified here is _incremental_ on top of the included disk space.
		Disk: awscdk.Size_Gibibytes(jsii.Number(10)),
	},
})
```

## Properties

- `baseCapacity`: number (required) — The number of machines allocated to the compute ﬂeet. Deﬁnes the number of builds that can run in parallel.

  Minimum value of 1.

- `computeConfiguration`: [ComputeConfiguration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild.ComputeConfiguration.html) — The compute configuration of the compute fleet.

  **Default:** do not specify compute configuration

  This is only permitted if `computeType` is set to ATTRIBUTE_BASED or
  CUSTOM_INSTANCE_TYPE. In such cases, this is required.

- `computeType`: [FleetComputeType](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild.FleetComputeType.html) (required) — The instance type of the compute fleet.

- `environmentType`: [EnvironmentType](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild.EnvironmentType.html) (required) — The build environment (operating system/architecture/accelerator) type made available to projects using this fleet.

- `fleetName`: string — The name of the Fleet.

  **Default:** CloudFormation generated name

- `overflowBehavior`: [FleetOverflowBehavior](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild.FleetOverflowBehavior.html) — The compute fleet overflow behavior.

  **Default:** undefined - AWS CodeBuild default behavior is QUEUE

  For overflow behavior `QUEUE`, overflow builds need to wait on the existing fleet instances to become available.

  For overflow behavior `ON_DEMAND`, overflow builds run on CodeBuild on-demand.

- `role`: [IRole](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — Service Role assumed by Fleet instances.

  **Default:** A role will be created if any permissions are granted

  This Role is not used by Project builds running on Fleet instances; Project
  builds assume the `role` on Project instead.

- `securityGroups`: [ISecurityGroup](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISecurityGroup.html)[] — What security groups to associate with the fleet's network interfaces. If none are provided, one will be created automatically.

  **Default:** A security group will be automatically created.

  Only used if `vpc` is supplied.

- `subnetSelection`: [SubnetSelection](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetSelection.html) — Where to place the network interfaces within the VPC.

  **Default:** private subnets if available else public subnets

  To access AWS services, your fleet needs to be in one of the following types of subnets:

  1. Subnets with access to the internet (of type PRIVATE_WITH_EGRESS).
  2. Private subnets unconnected to the internet, but with [VPC endpoints](https://docs.aws.amazon.com/codebuild/latest/userguide/use-vpc-endpoints-with-codebuild.html) for the necessary services.

  If you don't specify a subnet selection, the default behavior is to use PRIVATE_WITH_EGRESS subnets first if they exist,
  then PRIVATE_WITHOUT_EGRESS, and finally PUBLIC subnets. If your VPC doesn't have PRIVATE_WITH_EGRESS subnets but you need
  AWS service access, add VPC Endpoints to your private subnets.

- `vpc`: [IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) — VPC network to place fleet instance network interfaces.

  **Default:** No VPC is specified.

  Specify this if the fleet needs to access resources in a VPC.
