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

Support Auto Scaling groups Attribute-Based Instance Type Selection for EC2 Auto Scaling (aws_autoscaling_group) and EC2 Fleet (aws_spot_fleet_request) #21566

Closed
jnerin opened this issue Nov 1, 2021 · 7 comments · Fixed by #24795
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/autoscaling Issues and PRs that pertain to the autoscaling service. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@jnerin
Copy link

jnerin commented Nov 1, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

AWS improved the way you select instance types for autoscaling or fleets, now instead of passing a list of possible instance types you can set some attributes (like min and max VCpuCount, and min and max MemoryMiB among others) and let the ABS (yeah, they named it like that, from attribute-based instance type selection) choose the instances.

New or Affected Resource(s)

  • aws_autoscaling_group
  • aws_spot_fleet_request

Potential Terraform Configuration

resource "aws_autoscaling_group" "example" {
  availability_zones = ["us-east-1a"]
  desired_capacity   = 1
  max_size           = 1
  min_size           = 1

  mixed_instances_policy {
    launch_template {
      launch_template_specification {
        launch_template_id = aws_launch_template.example.id
      }

      override {
        instance_requirements {
          vcpu_count {
            min = "2"
            max = "4"
          }
          memory_mib {
            min = "2048"
          }
        }
      }
    }
  }
}

References

Requires

Requires AWS SDK v1.41.12

@jnerin jnerin added the enhancement Requests to existing resources that expand the functionality or scope. label Nov 1, 2021
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/autoscaling Issues and PRs that pertain to the autoscaling service. service/ec2 Issues and PRs that pertain to the ec2 service. labels Nov 1, 2021
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Nov 2, 2021
@wosiu
Copy link

wosiu commented Nov 5, 2021

+1000, some questions though:
Currently if I don't specify spot_max_price, it is calculated automatically based on the "on-demand" price (and I hope it gets the cheapest instance type I set in mixed_instances_policy->launch_template->override multiple times). How it's going to be calculated if ABS is provided and no specific instance type to refer to?
Or maybe the default behaviour I described is handled on AWS side and not tf provider?

@gudlyf
Copy link

gudlyf commented Nov 11, 2021

+1 for sure on this. We're anxious to move to this model, but really cannot until Terraform supports it.

There are also "Additional Instance Attributes" that will need to be supported as part of this, which could be quite extensive (i.e., CPU manufacturers, Memory per vCPU, Instance generation, Instance storage, etc.). This will likely make the implementation a bit complex.

@mwos-sl
Copy link

mwos-sl commented Dec 17, 2021

Are there any plans or ETA for this one?

@ahujarajesh
Copy link

Is there any plan to add this support?

@AdamTylerLynch
Copy link
Collaborator

AdamTylerLynch commented May 6, 2022

This change impacts the following resources (3):

  1. aws_autoscaling_group
  2. aws_ec2_fleet
  3. aws_spot_fleet_request

https://aws.amazon.com/about-aws/whats-new/2021/10/amazon-ec2-instance-auto-scaling-ec2-spot-fleet/

Plus aws_launch_template - see #24543.

@github-actions
Copy link

This functionality has been released in v4.16.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/autoscaling Issues and PRs that pertain to the autoscaling service. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
7 participants