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

Mixed Spot Fleets and Launch Configurations vs Launch Templates #6714

Closed
2 tasks
PeterBengtson opened this issue Mar 13, 2020 · 2 comments
Closed
2 tasks

Mixed Spot Fleets and Launch Configurations vs Launch Templates #6714

PeterBengtson opened this issue Mar 13, 2020 · 2 comments
Assignees
Labels
@aws-cdk/aws-autoscaling Related to Amazon EC2 Auto Scaling feature-request A feature should be added or improved.

Comments

@PeterBengtson
Copy link

PeterBengtson commented Mar 13, 2020

I need to create a mixed spot instance fleet, that is, a spot instance fleet which consists of multiple instance types. Currently in CDK, there is no L2 way of doing this. The AutoscalingGroup L2 construct doesn't provide a parameter to control spot instances except for the spotPrice optional param, and it also creates – behind the scenes, without any user control – a launch configuration (which has no CDK exported L2 counterpart, only an L1 CfnLaunchConfiguration). There is no way to make ASGs use Launch Templates; they always create a CfnLaunchConfiguration in the background, even though current best practice since 2017 is to use Launch Templates. You have no choice; neither do you have any control over the launch configuration resource created by the CDK. This is a problem since launch configurations and launch templates are mutually exclusive, and mixed fleets require the use of launch templates.

In a situation like this, I'd go for the L1 construct escape hatch, casting L2 constructs into L1 constructs as necessary. What I'd do is basically to cast the AutoscalingGroup to a CfnAutoscalingGroup, null out or delete its LaunchConfiguration L1 parameter, and then use the MixedInstancesPolicy param to supply a MixedInstancesPolicyProperty instead.

However, it's not clear whether L2 logic such as scaleToTrackMetric and others such as addUserData still will work, or if these have to be added manually on the L1 level to the ASG or to the new L1 CfnLaunchTemplate.

The question is whether it might be better to skip all the "cleverness" added by the CDK AutoscalingGroup L2 construct and build everything using the L1 ones, since the CDK makes too many assumptions for the L2 construct to be useful outside a fairly narrow range of use cases. Another option is to suggest that the CDK switches to launch templates internally, which should be easy since the autogenerated CfnLaunchConfiguration resource isn't exposed in any way.

I'm aware of cf #3077 and #1403

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@PeterBengtson PeterBengtson added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Mar 13, 2020
@NetaNir
Copy link
Contributor

NetaNir commented Mar 13, 2020

I'm aware of cf #3077 and #1403

And #6290? :)

We are planning to revisit this and see how we can use LaunchTemplates and LaunchConfiguration together or whether we can migrate LaunchTemplates without breaking anything.

@SomayaB SomayaB added @aws-cdk/aws-autoscaling Related to Amazon EC2 Auto Scaling and removed needs-triage This issue or PR still needs to be triaged. labels Mar 13, 2020
@NetaNir
Copy link
Contributor

NetaNir commented Mar 15, 2020

@PeterBengtson for better tracking of this issue Im closing this in favor of #6734.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-autoscaling Related to Amazon EC2 Auto Scaling feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

3 participants