aws-cdk-lib.aws_autoscaling.Signals

class Signals

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

Configure whether the AutoScalingGroup waits for signals.

If you do configure waiting for signals, you should make sure the instances invoke cfn-signal somewhere in their UserData to signal that they have started up (either successfully or unsuccessfully).

Signals are used both during intial creation and subsequent updates.

Example

declare const vpc: ec2.Vpc;
declare const instanceType: ec2.InstanceType;
declare const machineImage: ec2.IMachineImage;

new autoscaling.AutoScalingGroup(this, 'ASG', {
  vpc,
  instanceType,
  machineImage,

  // ...

  init: ec2.CloudFormationInit.fromElements(
    ec2.InitFile.fromString('/etc/my_instance', 'This got written during instance startup'),
  ),
  signals: autoscaling.Signals.waitForAll({
    timeout: Duration.minutes(10),
  }),
});

Initializer

new Signals()

Methods

NameDescription
renderCreationPolicy(renderOptions)Render the ASG's CreationPolicy.
protected doRender(options, count?)Helper to render the actual creation policy, as the logic between them is quite similar.
static waitForAll(options?)Wait for the desiredCapacity of the AutoScalingGroup amount of signals to have been received.
static waitForCount(count, options?)Wait for a specific amount of signals to have been received.
static waitForMinCapacity(options?)Wait for the minCapacity of the AutoScalingGroup amount of signals to have been received.

renderCreationPolicy(renderOptions)

public renderCreationPolicy(renderOptions: RenderSignalsOptions): CfnCreationPolicy

Parameters

  • renderOptions RenderSignalsOptions

Returns

  • CfnCreationPolicy

Render the ASG's CreationPolicy.


protected doRender(options, count?)

protected doRender(options: SignalsOptions, count?: number): CfnCreationPolicy

Parameters

  • options SignalsOptions
  • count number

Returns

  • CfnCreationPolicy

Helper to render the actual creation policy, as the logic between them is quite similar.


static waitForAll(options?)

public static waitForAll(options?: SignalsOptions): Signals

Parameters

  • options SignalsOptions

Returns

  • Signals

Wait for the desiredCapacity of the AutoScalingGroup amount of signals to have been received.

If no desiredCapacity has been configured, wait for minCapacity signals intead.

This number is used during initial creation and during replacing updates. During rolling updates, all updated instances must send a signal.


static waitForCount(count, options?)

public static waitForCount(count: number, options?: SignalsOptions): Signals

Parameters

  • count number
  • options SignalsOptions

Returns

  • Signals

Wait for a specific amount of signals to have been received.

You should send one signal per instance, so this represents the number of instances to wait for.

This number is used during initial creation and during replacing updates. During rolling updates, all updated instances must send a signal.


static waitForMinCapacity(options?)

public static waitForMinCapacity(options?: SignalsOptions): Signals

Parameters

  • options SignalsOptions

Returns

  • Signals

Wait for the minCapacity of the AutoScalingGroup amount of signals to have been received.

This number is used during initial creation and during replacing updates. During rolling updates, all updated instances must send a signal.