Show / Hide Table of Contents

Class AsgCapacityProvider

An Auto Scaling Group Capacity Provider.

Inheritance
object
AsgCapacityProvider
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AsgCapacityProvider : Construct
Syntax (vb)
Public Class AsgCapacityProvider Inherits Construct
Remarks

This allows an ECS cluster to target a specific EC2 Auto Scaling Group for the placement of tasks. Optionally (and recommended), ECS can manage the number of instances in the ASG to fit the tasks, and can ensure that instances are not prematurely terminated while there are still tasks running on them.

ExampleMetadata: infused

Examples
Vpc vpc;


             var cluster = new Cluster(this, "Cluster", new ClusterProps {
                 Vpc = vpc
             });

             // Either add default capacity
             cluster.AddCapacity("DefaultAutoScalingGroupCapacity", new AddCapacityOptions {
                 InstanceType = new InstanceType("t2.xlarge"),
                 DesiredCapacity = 3
             });

             // Or add customized capacity. Be sure to start the Amazon ECS-optimized AMI.
             var autoScalingGroup = new AutoScalingGroup(this, "ASG", new AutoScalingGroupProps {
                 Vpc = vpc,
                 InstanceType = new InstanceType("t2.xlarge"),
                 MachineImage = EcsOptimizedImage.AmazonLinux(),
                 // Or use Amazon ECS-Optimized Amazon Linux 2 AMI
                 // machineImage: EcsOptimizedImage.amazonLinux2(),
                 DesiredCapacity = 3
             });

             var capacityProvider = new AsgCapacityProvider(this, "AsgCapacityProvider", new AsgCapacityProviderProps {
                 AutoScalingGroup = autoScalingGroup
             });
             cluster.AddAsgCapacityProvider(capacityProvider);

Synopsis

Constructors

AsgCapacityProvider(Construct, string, IAsgCapacityProviderProps)

An Auto Scaling Group Capacity Provider.

Properties

AutoScalingGroup

Auto Scaling Group.

CanContainersAccessInstanceRole

(deprecated) Specifies whether the containers can access the container instance role.

CapacityProviderName

Capacity provider name.

EnableManagedDraining

Whether managed draining is enabled.

EnableManagedTerminationProtection

Whether managed termination protection is enabled.

MachineImageType

Auto Scaling Group machineImageType.

PROPERTY_INJECTION_ID

Uniquely identifies this class.

Constructors

AsgCapacityProvider(Construct, string, IAsgCapacityProviderProps)

An Auto Scaling Group Capacity Provider.

public AsgCapacityProvider(Construct scope, string id, IAsgCapacityProviderProps props)
Parameters
scope Construct
id string
props IAsgCapacityProviderProps
Remarks

This allows an ECS cluster to target a specific EC2 Auto Scaling Group for the placement of tasks. Optionally (and recommended), ECS can manage the number of instances in the ASG to fit the tasks, and can ensure that instances are not prematurely terminated while there are still tasks running on them.

ExampleMetadata: infused

Examples
Vpc vpc;


             var cluster = new Cluster(this, "Cluster", new ClusterProps {
                 Vpc = vpc
             });

             // Either add default capacity
             cluster.AddCapacity("DefaultAutoScalingGroupCapacity", new AddCapacityOptions {
                 InstanceType = new InstanceType("t2.xlarge"),
                 DesiredCapacity = 3
             });

             // Or add customized capacity. Be sure to start the Amazon ECS-optimized AMI.
             var autoScalingGroup = new AutoScalingGroup(this, "ASG", new AutoScalingGroupProps {
                 Vpc = vpc,
                 InstanceType = new InstanceType("t2.xlarge"),
                 MachineImage = EcsOptimizedImage.AmazonLinux(),
                 // Or use Amazon ECS-Optimized Amazon Linux 2 AMI
                 // machineImage: EcsOptimizedImage.amazonLinux2(),
                 DesiredCapacity = 3
             });

             var capacityProvider = new AsgCapacityProvider(this, "AsgCapacityProvider", new AsgCapacityProviderProps {
                 AutoScalingGroup = autoScalingGroup
             });
             cluster.AddAsgCapacityProvider(capacityProvider);

Properties

AutoScalingGroup

Auto Scaling Group.

public virtual AutoScalingGroup AutoScalingGroup { get; }
Property Value

AutoScalingGroup

Remarks

This allows an ECS cluster to target a specific EC2 Auto Scaling Group for the placement of tasks. Optionally (and recommended), ECS can manage the number of instances in the ASG to fit the tasks, and can ensure that instances are not prematurely terminated while there are still tasks running on them.

ExampleMetadata: infused

CanContainersAccessInstanceRole

(deprecated) Specifies whether the containers can access the container instance role.

[Obsolete("See https://github.com/aws/aws-cdk/discussions/32609")]
public virtual bool? CanContainersAccessInstanceRole { get; }
Property Value

bool?

Remarks

Default: true if

Stability: Deprecated

Aws-cdk: /aws-ecs:disableEcsImdsBlocking is set to false.

CapacityProviderName

Capacity provider name.

public virtual string CapacityProviderName { get; }
Property Value

string

Remarks

Default: Chosen by CloudFormation

EnableManagedDraining

Whether managed draining is enabled.

public virtual bool? EnableManagedDraining { get; }
Property Value

bool?

Remarks

This allows an ECS cluster to target a specific EC2 Auto Scaling Group for the placement of tasks. Optionally (and recommended), ECS can manage the number of instances in the ASG to fit the tasks, and can ensure that instances are not prematurely terminated while there are still tasks running on them.

ExampleMetadata: infused

EnableManagedTerminationProtection

Whether managed termination protection is enabled.

public virtual bool? EnableManagedTerminationProtection { get; }
Property Value

bool?

Remarks

This allows an ECS cluster to target a specific EC2 Auto Scaling Group for the placement of tasks. Optionally (and recommended), ECS can manage the number of instances in the ASG to fit the tasks, and can ensure that instances are not prematurely terminated while there are still tasks running on them.

ExampleMetadata: infused

MachineImageType

Auto Scaling Group machineImageType.

public virtual MachineImageType MachineImageType { get; }
Property Value

MachineImageType

Remarks

This allows an ECS cluster to target a specific EC2 Auto Scaling Group for the placement of tasks. Optionally (and recommended), ECS can manage the number of instances in the ASG to fit the tasks, and can ensure that instances are not prematurely terminated while there are still tasks running on them.

ExampleMetadata: infused

PROPERTY_INJECTION_ID

Uniquely identifies this class.

public static string PROPERTY_INJECTION_ID { get; }
Property Value

string

Remarks

This allows an ECS cluster to target a specific EC2 Auto Scaling Group for the placement of tasks. Optionally (and recommended), ECS can manage the number of instances in the ASG to fit the tasks, and can ensure that instances are not prematurely terminated while there are still tasks running on them.

ExampleMetadata: infused

Back to top Generated by DocFX