Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(aws-autoscaling): Support a external LaunchConfiguration and LaunchTemplate to AutoScalingGroup #1404

Closed
wants to merge 4 commits into from

Conversation

cohalz
Copy link
Contributor

@cohalz cohalz commented Dec 19, 2018

Fixed #1403

Pull Request Checklist

Please check all boxes, including N/A items:

Testing

  • Unit test and/or integration test added
  • Toolkit change?: integration tests manually executed (paste output to the PR description)
  • Init template change?: coordinated update of integration tests (currently maintained in a private repo).

Documentation

  • README: README and/or documentation topic updated
  • jsdocs: All public APIs documented

Title and description

  • Change type: Title is prefixed with change type:
    • fix(module): <title> bug fix (patch)
    • feat(module): <title> feature/capability (minor)
    • chore(module): <title> won't appear in changelog
    • build(module): <title> won't appear in changelog
  • Title format: Title uses lower case and doesn't end with a period
  • Breaking change?: Last paragraph of description is: BREAKING CHANGE: <describe exactly what changed and how to achieve similar behavior + link to documentation/gist/issue if more details are required>
  • References: Indicate issues fixed via: Fixes #xxx or Closes #xxx

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.

@cohalz cohalz requested a review from a team as a code owner December 19, 2018 15:41
@cohalz cohalz changed the title feat(aws-autoscaling): Support a external LaunchConfiguration and LaunchTemplate feat(aws-autoscaling): Support a external LaunchConfiguration and LaunchTemplate to AutoScalingGroup Dec 19, 2018
@eladb
Copy link
Contributor

eladb commented Dec 19, 2018

@cohalz this is awesome, but we generally avoid "leaking" the Cfn classes in the API of AWS constructs. Granted, this is a large surface area to cover, but also an opportunity to actually provide a lot of value to users.

As a workaround, users can use property overrides, so I hope you are not blocked by this.

Let me know if you wish to take this to the next level. It's not a small project, I am aware 😄

@cohalz
Copy link
Contributor Author

cohalz commented Dec 19, 2018

@eladb thanks, I understand constructs.

I want to use ECS Construct Library with spot instances, but AutoScalingGroup does not support LaunchTemplate. Also, InstanceDrainHook does not exported, so I need to describe too long Resources to construct cluster.

So, I added #1392 and this PR.

@cohalz
Copy link
Contributor Author

cohalz commented Dec 20, 2018

I tried this code.

const asgResource = asg.findChild('ASG') as autoscaling.cloudformation.AutoScalingGroupResource

asgResource.addPropertyDeletionOverride('LaunchConfigurationName')
asgResource.addPropertyOverride('LaunchTemplate', {
  LaunchTemplateId: appLaunchTemplate.ref,
  Version: '1'
})

It's working, but AWS::AutoScaling::LaunchConfiguration will be created uselessly.

@eladb
Copy link
Contributor

eladb commented Dec 20, 2018

It's working, but AWS::AutoScaling::LaunchConfiguration will be created uselessly.

This actually brings up a missing feature in our "escape hatching" mechanism. You want to be able to delete an entire resource from a subtree. Raised #1408


If your current use case is to only be able to pass in a LaunchTemplateId to the ASG, how about we repurpose this PR to only add an optional property to the ASG props LaunchTemplateId: string and LaunchTemplateVersion: string. Then, if LaunchTemplateId is passed, a LaunchConfiguration won't be created and the ID (+ version) will be configured instead.

Would that make sense?

@rix0rrr
Copy link
Contributor

rix0rrr commented Dec 28, 2018

I agree we should either limit the scope of this change, or implement a proper Launch Configuration construct.

@eladb
Copy link
Contributor

eladb commented Feb 5, 2019

@cohalz closing for now. Feel free to reopen when/if you wish to continue this work.

@eladb eladb closed this Feb 5, 2019
@LeifW
Copy link

LeifW commented Mar 31, 2021

Would this be worth revisiting now that we have #12385 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AutoScaling: Support a external LaunchConfiguration and LaunchTemplate to AutoScalingGroup
4 participants