Class ManagedInstancesCapacityProviderProps.Builder
java.lang.Object
software.amazon.awscdk.services.ecs.ManagedInstancesCapacityProviderProps.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<ManagedInstancesCapacityProviderProps>
- Enclosing interface:
ManagedInstancesCapacityProviderProps
@Stability(Stable)
public static final class ManagedInstancesCapacityProviderProps.Builder
extends Object
implements software.amazon.jsii.Builder<ManagedInstancesCapacityProviderProps>
A builder for
ManagedInstancesCapacityProviderProps
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the configured instance.capacityProviderName
(String capacityProviderName) Sets the value ofManagedInstancesCapacityProviderProps.getCapacityProviderName()
ec2InstanceProfile
(IInstanceProfile ec2InstanceProfile) Sets the value ofManagedInstancesCapacityProviderProps.getEc2InstanceProfile()
infrastructureRole
(IRole infrastructureRole) Sets the value ofManagedInstancesCapacityProviderProps.getInfrastructureRole()
instanceRequirements
(InstanceRequirementsConfig instanceRequirements) Sets the value ofManagedInstancesCapacityProviderProps.getInstanceRequirements()
monitoring
(InstanceMonitoring monitoring) Sets the value ofManagedInstancesCapacityProviderProps.getMonitoring()
propagateTags
(PropagateManagedInstancesTags propagateTags) Sets the value ofManagedInstancesCapacityProviderProps.getPropagateTags()
securityGroups
(List<? extends ISecurityGroup> securityGroups) Sets the value ofManagedInstancesCapacityProviderProps.getSecurityGroups()
Sets the value ofManagedInstancesCapacityProviderProps.getSubnets()
taskVolumeStorage
(Size taskVolumeStorage) Sets the value ofManagedInstancesCapacityProviderProps.getTaskVolumeStorage()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
ec2InstanceProfile
@Stability(Stable) public ManagedInstancesCapacityProviderProps.Builder ec2InstanceProfile(IInstanceProfile ec2InstanceProfile) Sets the value ofManagedInstancesCapacityProviderProps.getEc2InstanceProfile()
- Parameters:
ec2InstanceProfile
- The EC2 instance profile that will be attached to instances launched by this capacity provider. This parameter is required. This instance profile must contain the necessary IAM permissions for ECS container instances to register with the cluster and run tasks. At minimum, it should include permissions for ECS agent communication, ECR image pulling, and CloudWatch logging.- Returns:
this
-
subnets
@Stability(Stable) public ManagedInstancesCapacityProviderProps.Builder subnets(List<? extends ISubnet> subnets) Sets the value ofManagedInstancesCapacityProviderProps.getSubnets()
- Parameters:
subnets
- The VPC subnets where EC2 instances will be launched. This parameter is required. This array must be non-empty and should contain subnets from the VPC where you want the managed instances to be deployed.- Returns:
this
-
capacityProviderName
@Stability(Stable) public ManagedInstancesCapacityProviderProps.Builder capacityProviderName(String capacityProviderName) Sets the value ofManagedInstancesCapacityProviderProps.getCapacityProviderName()
- Parameters:
capacityProviderName
- The name of the capacity provider. If a name is specified, it cannot start withaws
,ecs
, orfargate
. If no name is specified, a default name in the CFNStackName-CFNResourceName-RandomString format is used. If the stack name starts withaws
,ecs
, orfargate
, a unique resource name is generated that starts withcp-
.- Returns:
this
-
infrastructureRole
@Stability(Stable) public ManagedInstancesCapacityProviderProps.Builder infrastructureRole(IRole infrastructureRole) Sets the value ofManagedInstancesCapacityProviderProps.getInfrastructureRole()
- Parameters:
infrastructureRole
- The IAM role that ECS uses to manage the infrastructure for the capacity provider. This role is used by ECS to perform actions such as launching and terminating instances, managing Auto Scaling Groups, and other infrastructure operations required for the managed instances capacity provider.- Returns:
this
-
instanceRequirements
@Stability(Stable) public ManagedInstancesCapacityProviderProps.Builder instanceRequirements(InstanceRequirementsConfig instanceRequirements) Sets the value ofManagedInstancesCapacityProviderProps.getInstanceRequirements()
- Parameters:
instanceRequirements
- The instance requirements configuration for EC2 instance selection. This allows you to specify detailed requirements for instance selection including vCPU count ranges, memory ranges, CPU manufacturers (Intel, AMD, AWS Graviton), instance generations, network performance requirements, and many other criteria. ECS will automatically select appropriate instance types that meet these requirements.- Returns:
this
-
monitoring
@Stability(Stable) public ManagedInstancesCapacityProviderProps.Builder monitoring(InstanceMonitoring monitoring) Sets the value ofManagedInstancesCapacityProviderProps.getMonitoring()
- Parameters:
monitoring
- The CloudWatch monitoring configuration for the EC2 instances. Determines the granularity of CloudWatch metrics collection for the instances. Detailed monitoring incurs additional costs but provides better observability.- Returns:
this
-
propagateTags
@Stability(Stable) public ManagedInstancesCapacityProviderProps.Builder propagateTags(PropagateManagedInstancesTags propagateTags) Sets the value ofManagedInstancesCapacityProviderProps.getPropagateTags()
- Parameters:
propagateTags
- Specifies whether to propagate tags from the capacity provider to the launched instances. When set to CAPACITY_PROVIDER, tags applied to the capacity provider resource will be automatically applied to all EC2 instances launched by this capacity provider.- Returns:
this
-
securityGroups
@Stability(Stable) public ManagedInstancesCapacityProviderProps.Builder securityGroups(List<? extends ISecurityGroup> securityGroups) Sets the value ofManagedInstancesCapacityProviderProps.getSecurityGroups()
- Parameters:
securityGroups
- The security groups to associate with the launched EC2 instances. These security groups control the network traffic allowed to and from the instances. If not specified, the default security group of the VPC containing the subnets will be used.- Returns:
this
-
taskVolumeStorage
@Stability(Stable) public ManagedInstancesCapacityProviderProps.Builder taskVolumeStorage(Size taskVolumeStorage) Sets the value ofManagedInstancesCapacityProviderProps.getTaskVolumeStorage()
- Parameters:
taskVolumeStorage
- The size of the task volume storage attached to each instance. This storage is used for container images, container logs, and temporary files. Larger storage may be needed for workloads with large container images or applications that generate significant temporary data.- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<ManagedInstancesCapacityProviderProps>
- Returns:
- a new instance of
ManagedInstancesCapacityProviderProps
- Throws:
NullPointerException
- if any required attribute was not provided
-