Fleet
- class aws_cdk.aws_codebuild.Fleet(scope, id, *, base_capacity, compute_type, environment_type, compute_configuration=None, fleet_name=None, overflow_behavior=None, role=None, security_groups=None, subnet_selection=None, vpc=None)
Bases:
ResourceFleet 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:
https://docs.aws.amazon.com/codebuild/latest/userguide/fleets.html
- ExampleMetadata:
infused
Example:
fleet = codebuild.Fleet(self, "Fleet", compute_type=codebuild.FleetComputeType.MEDIUM, environment_type=codebuild.EnvironmentType.LINUX_CONTAINER, base_capacity=1 ) codebuild.Project(self, "Project", environment=codebuild.BuildEnvironment( fleet=fleet, build_image=codebuild.LinuxBuildImage.STANDARD_7_0 ) )
- Parameters:
scope (
Construct)id (
str)base_capacity (
Union[int,float]) – The number of machines allocated to the compute fleet. Defines the number of builds that can run in parallel. Minimum value of 1.compute_type (
FleetComputeType) – The instance type of the compute fleet.environment_type (
EnvironmentType) – The build environment (operating system/architecture/accelerator) type made available to projects using this fleet.compute_configuration (
Union[ComputeConfiguration,Dict[str,Any],None]) – The compute configuration of the compute fleet. This is only permitted ifcomputeTypeis set to ATTRIBUTE_BASED or CUSTOM_INSTANCE_TYPE. In such cases, this is required. Default: - do not specify compute configurationfleet_name (
Optional[str]) – The name of the Fleet. Default: - CloudFormation generated nameoverflow_behavior (
Optional[FleetOverflowBehavior]) – The compute fleet overflow behavior. For overflow behaviorQUEUE, overflow builds need to wait on the existing fleet instances to become available. For overflow behaviorON_DEMAND, overflow builds run on CodeBuild on-demand. Default: undefined - AWS CodeBuild default behavior is QUEUErole (
Optional[IRole]) – Service Role assumed by Fleet instances. This Role is not used by Project builds running on Fleet instances; Project builds assume theroleon Project instead. Default: - A role will be created if any permissions are grantedsecurity_groups (
Optional[Sequence[ISecurityGroup]]) – What security groups to associate with the fleet’s network interfaces. If none are provided, one will be created automatically. Only used ifvpcis supplied. Default: - A security group will be automatically created.subnet_selection (
Union[SubnetSelection,Dict[str,Any],None]) – 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: 1. Subnets with access to the internet (of type PRIVATE_WITH_EGRESS). 2. 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. Default: - private subnets if available else public subnetsvpc (
Optional[IVpc]) – VPC network to place fleet instance network interfaces. Specify this if the fleet needs to access resources in a VPC. Default: - No VPC is specified.
Methods
- apply_removal_policy(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).- Parameters:
policy (
RemovalPolicy)- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- PROPERTY_INJECTION_ID = 'aws-cdk-lib.aws-codebuild.Fleet'
- compute_type
The compute type of the fleet.
- connections
The network connections associated with this Fleet’s security group(s) in the configured VPC.
- env
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.
- environment_type
The build environment (operating system/architecture/accelerator) type made available to projects using this fleet.
- fleet_arn
The ARN of the fleet.
- fleet_name
The name of the fleet.
- grant_principal
The grant principal for this Fleet’s service role.
- node
The tree node.
- stack
The stack in which this resource is defined.
Static Methods
- classmethod from_fleet_arn(scope, id, fleet_arn)
Creates a Fleet construct that represents an external fleet.
- classmethod is_construct(x)
Checks if
xis a construct.Use this method instead of
instanceofto properly detectConstructinstances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructslibrary on disk are seen as independent, completely different libraries. As a consequence, the classConstructin each copy of theconstructslibrary is seen as a different class, and an instance of one class will not test asinstanceofthe other class.npm installwill not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructslibrary can be accidentally installed, andinstanceofwill behave unpredictably. It is safest to avoid usinginstanceof, and using this type-testing method instead.- Parameters:
x (
Any) – Any object.- Return type:
bool- Returns:
true if
xis an object created from a class which extendsConstruct.
- classmethod is_owned_resource(construct)
Returns true if the construct was created by CDK, and false otherwise.
- Parameters:
construct (
IConstruct)- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct)- Return type:
bool