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
, IGrantable
, IConnectable
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. |
overflow | Fleet | The compute fleet overflow behavior. |
role? | IRole | Service Role assumed by Fleet instances. |
security | ISecurity [] | What security groups to associate with the fleet's network interfaces. If none are provided, one will be created automatically. |
subnet | Subnet | Where to place the network interfaces within the VPC. |
vpc? | IVpc | VPC network to place fleet instance network interfaces. |
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 permitted if computeType
is set to ATTRIBUTE_BASED or
CUSTOM_INSTANCE_TYPE. In such cases, this is required.
fleetName?
Type:
string
(optional, default: CloudFormation generated name)
The name of the Fleet.
overflowBehavior?
Type:
Fleet
(optional, default: undefined - AWS CodeBuild default behavior is QUEUE)
The compute fleet overflow behavior.
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?
Type:
IRole
(optional, default: A role will be created if any permissions are granted)
Service Role assumed by Fleet instances.
This Role is not used by Project builds running on Fleet instances; Project
builds assume the role
on Project instead.
securityGroups?
Type:
ISecurity
[]
(optional, default: A security group will be automatically created.)
What security groups to associate with the fleet's network interfaces. If none are provided, one will be created automatically.
Only used if vpc
is supplied.
subnetSelection?
Type:
Subnet
(optional, default: private subnets if available else public subnets)
Where to place the network interfaces within the VPC.
To access AWS services, your fleet needs to be in one of the following types of subnets:
- Subnets with access to the internet (of type PRIVATE_WITH_EGRESS).
- Private subnets unconnected to the internet, but with VPC endpoints 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.
See also: https://docs.aws.amazon.com/codebuild/latest/userguide/vpc-support.html
vpc?
Type:
IVpc
(optional, default: No VPC is specified.)
VPC network to place fleet instance network interfaces.
Specify this if the fleet needs to access resources in a VPC.
Properties
Name | Type | Description |
---|---|---|
compute | Fleet | The compute type of the fleet. |
connections | Connections | The network connections associated with this Fleet's security group(s) in the configured VPC. |
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. |
grant | IPrincipal | The grant principal for this Fleet's service role. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
static PROPERTY_INJECTION_ID | string | Uniquely identifies this class. |
computeType
Type:
Fleet
The compute type of the fleet.
connections
Type:
Connections
The network connections associated with this Fleet's security group(s) in the configured VPC.
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.
grantPrincipal
Type:
IPrincipal
The grant principal for this Fleet's service role.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
static PROPERTY_INJECTION_ID
Type:
string
Uniquely identifies this class.
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.