Class ManagedInstancesCapacityProvider.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<ManagedInstancesCapacityProvider>
- Enclosing class:
ManagedInstancesCapacityProvider
ManagedInstancesCapacityProvider.-
Method Summary
Modifier and TypeMethodDescriptionbuild()capacityProviderName(String capacityProviderName) The name of the capacity provider.ec2InstanceProfile(IInstanceProfile ec2InstanceProfile) The EC2 instance profile that will be attached to instances launched by this capacity provider.infrastructureRole(IRole infrastructureRole) The IAM role that ECS uses to manage the infrastructure for the capacity provider.instanceRequirements(InstanceRequirementsConfig instanceRequirements) The instance requirements configuration for EC2 instance selection.monitoring(InstanceMonitoring monitoring) The CloudWatch monitoring configuration for the EC2 instances.propagateTags(PropagateManagedInstancesTags propagateTags) Specifies whether to propagate tags from the capacity provider to the launched instances.securityGroups(List<? extends ISecurityGroup> securityGroups) The security groups to associate with the launched EC2 instances.The VPC subnets where EC2 instances will be launched.taskVolumeStorage(Size taskVolumeStorage) The size of the task volume storage attached to each instance.
-
Method Details
-
create
@Stability(Stable) public static ManagedInstancesCapacityProvider.Builder create(software.constructs.Construct scope, String id) - Parameters:
scope- This parameter is required.id- This parameter is required.- Returns:
- a new instance of
ManagedInstancesCapacityProvider.Builder.
-
ec2InstanceProfile
@Stability(Stable) public ManagedInstancesCapacityProvider.Builder ec2InstanceProfile(IInstanceProfile ec2InstanceProfile) The EC2 instance profile that will be attached to instances launched by this capacity provider.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.
- Parameters:
ec2InstanceProfile- The EC2 instance profile that will be attached to instances launched by this capacity provider. This parameter is required.- Returns:
this
-
subnets
@Stability(Stable) public ManagedInstancesCapacityProvider.Builder subnets(List<? extends ISubnet> subnets) The VPC subnets where EC2 instances will be launched.This array must be non-empty and should contain subnets from the VPC where you want the managed instances to be deployed.
- Parameters:
subnets- The VPC subnets where EC2 instances will be launched. This parameter is required.- Returns:
this
-
capacityProviderName
@Stability(Stable) public ManagedInstancesCapacityProvider.Builder capacityProviderName(String capacityProviderName) The name of the capacity provider.If a name is specified, it cannot start with
aws,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-.Default: CloudFormation-generated name
- Parameters:
capacityProviderName- The name of the capacity provider. This parameter is required.- Returns:
this
-
infrastructureRole
@Stability(Stable) public ManagedInstancesCapacityProvider.Builder infrastructureRole(IRole 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.
Default: - A new role will be created with the AmazonECSInfrastructureRolePolicyForManagedInstances managed policy
- Parameters:
infrastructureRole- The IAM role that ECS uses to manage the infrastructure for the capacity provider. This parameter is required.- Returns:
this
-
instanceRequirements
@Stability(Stable) public ManagedInstancesCapacityProvider.Builder instanceRequirements(InstanceRequirementsConfig 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.
Default: - no specific instance requirements, ECS will choose appropriate instances
- Parameters:
instanceRequirements- The instance requirements configuration for EC2 instance selection. This parameter is required.- Returns:
this
-
monitoring
@Stability(Stable) public ManagedInstancesCapacityProvider.Builder monitoring(InstanceMonitoring 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.
Default: - no enhanced monitoring (basic monitoring only)
- Parameters:
monitoring- The CloudWatch monitoring configuration for the EC2 instances. This parameter is required.- Returns:
this
-
propagateTags
@Stability(Stable) public ManagedInstancesCapacityProvider.Builder propagateTags(PropagateManagedInstancesTags 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.
Default: PropagateManagedInstancesTags.NONE - no tag propagation
- Parameters:
propagateTags- Specifies whether to propagate tags from the capacity provider to the launched instances. This parameter is required.- Returns:
this
-
securityGroups
@Stability(Stable) public ManagedInstancesCapacityProvider.Builder securityGroups(List<? extends ISecurityGroup> 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.
Default: - default security group of the VPC
- Parameters:
securityGroups- The security groups to associate with the launched EC2 instances. This parameter is required.- Returns:
this
-
taskVolumeStorage
@Stability(Stable) public ManagedInstancesCapacityProvider.Builder taskVolumeStorage(Size 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.
Default: Size.gibibytes(80)
- Parameters:
taskVolumeStorage- The size of the task volume storage attached to each instance. This parameter is required.- Returns:
this
-
build
- Specified by:
buildin interfacesoftware.amazon.jsii.Builder<ManagedInstancesCapacityProvider>- Returns:
- a newly built instance of
ManagedInstancesCapacityProvider.
-