class Fleet (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.CodeBuild.Fleet |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awscodebuild#Fleet |
![]() | software.amazon.awscdk.services.codebuild.Fleet |
![]() | aws_cdk.aws_codebuild.Fleet |
![]() | aws-cdk-lib » aws_codebuild » Fleet |
Implements
IConstruct
, IDependable
, IResource
, IFleet
Fleet for a reserved capacity CodeBuild project.
Fleets allow for process builds or tests to run immediately and reduces build durations, by reserving compute resources for your projects.
You will be charged for the resources in the fleet, even if they are idle.
See also: https://docs.aws.amazon.com/codebuild/latest/userguide/fleets.html
Example
const fleet = new codebuild.Fleet(this, 'Fleet', {
computeType: codebuild.FleetComputeType.MEDIUM,
environmentType: codebuild.EnvironmentType.LINUX_CONTAINER,
baseCapacity: 1,
});
new codebuild.Project(this, 'Project', {
environment: {
fleet,
buildImage: codebuild.LinuxBuildImage.STANDARD_7_0,
},
// ...
})
Initializer
new Fleet(scope: Construct, id: string, props: FleetProps)
Parameters
- scope
Construct
- id
string
- props
Fleet
Props
Construct Props
Name | Type | Description |
---|---|---|
base | number | The number of machines allocated to the compute fleet. Defines the number of builds that can run in parallel. |
compute | Fleet | The instance type of the compute fleet. |
environment | Environment | The build environment (operating system/architecture/accelerator) type made available to projects using this fleet. |
compute | Compute | The compute configuration of the compute fleet. |
fleet | string | The name of the Fleet. |
baseCapacity
Type:
number
The number of machines allocated to the compute fleet. Defines the number of builds that can run in parallel.
Minimum value of 1.
computeType
Type:
Fleet
The instance type of the compute fleet.
environmentType
Type:
Environment
The build environment (operating system/architecture/accelerator) type made available to projects using this fleet.
computeConfiguration?
Type:
Compute
(optional, default: do not specify compute configuration)
The compute configuration of the compute fleet.
This is only required if computeType
is set to ATTRIBUTE_BASED.
fleetName?
Type:
string
(optional, default: CloudFormation generated name)
The name of the Fleet.
Properties
Name | Type | Description |
---|---|---|
compute | Fleet | The compute type of the fleet. |
env | Resource | The environment this resource belongs to. |
environment | Environment | The build environment (operating system/architecture/accelerator) type made available to projects using this fleet. |
fleet | string | The ARN of the fleet. |
fleet | string | The name of the fleet. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
computeType
Type:
Fleet
The compute type of the fleet.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
environmentType
Type:
Environment
The build environment (operating system/architecture/accelerator) type made available to projects using this fleet.
fleetArn
Type:
string
The ARN of the fleet.
fleetName
Type:
string
The name of the fleet.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Creates a Fleet construct that represents an external fleet. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromFleetArn(scope, id, fleetArn)
public static fromFleetArn(scope: Construct, id: string, fleetArn: string): IFleet
Parameters
- scope
Construct
— The scope creating construct (usuallythis
). - id
string
— The construct's id. - fleetArn
string
— The ARN of the fleet.
Returns
Creates a Fleet construct that represents an external fleet.