aws-cdk-lib.aws_autoscaling.IAutoScalingGroup

interface IAutoScalingGroup

LanguageType name
.NETAmazon.CDK.AWS.AutoScaling.IAutoScalingGroup
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsautoscaling#IAutoScalingGroup
Javasoftware.amazon.awscdk.services.autoscaling.IAutoScalingGroup
Pythonaws_cdk.aws_autoscaling.IAutoScalingGroup
TypeScript (source)aws-cdk-lib » aws_autoscaling » IAutoScalingGroup

Implemented by AutoScalingGroup

Obtainable from AutoScalingGroup.fromAutoScalingGroupName()

An AutoScalingGroup.

Properties

NameTypeDescription
autoScalingGroupArnstringThe arn of the AutoScalingGroup.
autoScalingGroupNamestringThe name of the AutoScalingGroup.
envResourceEnvironmentThe environment this resource belongs to.
grantPrincipalIPrincipalThe principal to grant permissions to.
nodeNodeThe tree node.
osTypeOperatingSystemTypeThe operating system family that the instances in this auto-scaling group belong to.
stackStackThe stack in which this resource is defined.

autoScalingGroupArn

Type: string

The arn of the AutoScalingGroup.


autoScalingGroupName

Type: string

The name of the AutoScalingGroup.


env

Type: ResourceEnvironment

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.


grantPrincipal

Type: IPrincipal

The principal to grant permissions to.


node

Type: Node

The tree node.


osType

Type: OperatingSystemType

The operating system family that the instances in this auto-scaling group belong to.

Is 'UNKNOWN' for imported ASGs.


stack

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
addLifecycleHook(id, props)Send a message to either an SQS queue or SNS topic when instances launch or terminate.
addUserData(...commands)Add command to the startup script of fleet instances.
addWarmPool(options?)Add a pool of pre-initialized EC2 instances that sits alongside an Auto Scaling group.
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
scaleOnCpuUtilization(id, props)Scale out or in to achieve a target CPU utilization.
scaleOnIncomingBytes(id, props)Scale out or in to achieve a target network ingress rate.
scaleOnMetric(id, props)Scale out or in, in response to a metric.
scaleOnOutgoingBytes(id, props)Scale out or in to achieve a target network egress rate.
scaleOnSchedule(id, props)Scale out or in based on time.
scaleToTrackMetric(id, props)Scale out or in in order to keep a metric around a target value.

addLifecycleHook(id, props)

public addLifecycleHook(id: string, props: BasicLifecycleHookProps): LifecycleHook

Parameters

  • id string
  • props BasicLifecycleHookProps

Returns

  • LifecycleHook

Send a message to either an SQS queue or SNS topic when instances launch or terminate.


addUserData(...commands)

public addUserData(...commands: string[]): void

Parameters

  • commands string

Add command to the startup script of fleet instances.

The command must be in the scripting language supported by the fleet's OS (i.e. Linux/Windows). Does nothing for imported ASGs.


addWarmPool(options?)

public addWarmPool(options?: WarmPoolOptions): WarmPool

Parameters

  • options WarmPoolOptions

Returns

  • WarmPool

Add a pool of pre-initialized EC2 instances that sits alongside an Auto Scaling group.


applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

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).


scaleOnCpuUtilization(id, props)

public scaleOnCpuUtilization(id: string, props: CpuUtilizationScalingProps): TargetTrackingScalingPolicy

Parameters

  • id string
  • props CpuUtilizationScalingProps

Returns

  • TargetTrackingScalingPolicy

Scale out or in to achieve a target CPU utilization.


scaleOnIncomingBytes(id, props)

public scaleOnIncomingBytes(id: string, props: NetworkUtilizationScalingProps): TargetTrackingScalingPolicy

Parameters

  • id string
  • props NetworkUtilizationScalingProps

Returns

  • TargetTrackingScalingPolicy

Scale out or in to achieve a target network ingress rate.


scaleOnMetric(id, props)

public scaleOnMetric(id: string, props: BasicStepScalingPolicyProps): StepScalingPolicy

Parameters

  • id string
  • props BasicStepScalingPolicyProps

Returns

  • StepScalingPolicy

Scale out or in, in response to a metric.


scaleOnOutgoingBytes(id, props)

public scaleOnOutgoingBytes(id: string, props: NetworkUtilizationScalingProps): TargetTrackingScalingPolicy

Parameters

  • id string
  • props NetworkUtilizationScalingProps

Returns

  • TargetTrackingScalingPolicy

Scale out or in to achieve a target network egress rate.


scaleOnSchedule(id, props)

public scaleOnSchedule(id: string, props: BasicScheduledActionProps): ScheduledAction

Parameters

  • id string
  • props BasicScheduledActionProps

Returns

  • ScheduledAction

Scale out or in based on time.


scaleToTrackMetric(id, props)

public scaleToTrackMetric(id: string, props: MetricTargetTrackingProps): TargetTrackingScalingPolicy

Parameters

  • id string
  • props MetricTargetTrackingProps

Returns

  • TargetTrackingScalingPolicy

Scale out or in in order to keep a metric around a target value.