Skip to content

Conversation

@sAchin-680
Copy link

Issue # (if applicable)

Closes #34847 - [AutoScalingGroup]: Add flag to remove automatic cfn-signal addition to userdata when using init property

Reason for this change

When using CloudFormation Init with AutoScalingGroups, cfn-signal is automatically called immediately after cfn-init, causing instances to signal "ready" before applications are fully initialized. This leads to premature instance replacement during updates.

Description of changes

Added includeSignalCommand option to ApplyCloudFormationInitOptions to allow users to disable automatic cfn-signal addition and manage signaling manually.

Key changes:

  • Add includeSignalCommand?: boolean property (defaults to true)
  • Update CloudFormationInit.attach() to conditionally include cfn-signal
  • Support both Linux and Windows platforms
  • Add 6 unit tests covering new functionality and backward compatibility

Description of how you validated changes

  • Added 6 unit tests (3 AutoScaling + 3 EC2)
  • All 42/42 tests passing
  • Verified backward compatibility (defaults to true)
  • Tested both Linux and Windows implementations

Checklist

  • My code adheres to the CONTRIBUTING GUIDE and DESIGN GUIDELINES

…nal in init

Key changes:
- Add includeSignalCommand property to ApplyCloudFormationInitOptions
- Add includeSignalCommand property to AttachInitOptions
- Update CloudFormationInit.attach() to conditionally include cfn-signal
- Update AutoScalingGroup.applyCloudFormationInit() to pass through option
- Add comprehensive test coverage for both Linux and Windows platforms
- Update documentation with usage examples

The option defaults to true to maintain backward compatibility.

Fixes aws#34847

Signed-off-by: SACHIN KUMAR <[email protected]>
@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Nov 6, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team November 6, 2025 11:52
@github-actions github-actions bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Nov 6, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter fails with the following errors:

❌ Features must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

✅ A exemption request has been requested. Please wait for a maintainer's review.

@sAchin-680
Copy link
Author

❌ Features must contain a change to an integration test file and the resulting snapshot.

Exemption Request

This PR adds a configuration flag ([includeSignalCommand]) that controls UserData generation at synth time. An integration test is not required because:

  • Comprehensive unit test coverage: 42 unit tests (6 new) verify UserData generation with/without the flag for both Linux and Windows
  • Build-time only feature: Only modifies generated CloudFormation template text, not runtime behavior
  • Follows existing pattern: Similar to [includeUrl] and [includeRole] options which also lack integration tests
  • Backward compatible: Defaults to true, all existing tests pass
    The unit tests thoroughly verify the UserData contains the correct commands based on the flag value.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AutoScalingGroup]: Add flag to remove automatic cfn-signal addition to userdata when using init property

2 participants