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

Please add support for --instance-market-options when creating EC2 instances. #3340

Closed
MarkRebuck opened this issue Feb 12, 2018 · 2 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@MarkRebuck
Copy link

Terraform Version

Terraform v0.11.3
+ provider.aws v1.9.0
+ provider.template v1.0.0

Additional Context

Apologies if this is a duplicate... I searched but there are 1451 Issues so my search-fu might have missed something :-).

As of late 2017, AWS supports a new flag --instance-market-options to launch Spot instances from the same API used to launch on-demand or reserved instances. See https://aws.amazon.com/blogs/aws/amazon-ec2-update-streamlined-access-to-spot-capacity-smooth-price-changes-instance-hibernation/ and https://docs.aws.amazon.com/cli/latest/reference/ec2/run-instances.html

Supporting this option would accomplish several goals:

  1. It would provide a very clean way to convert tradition on-demand instance requests to spot requests, without needing to deal with the previous Spot Fleet API.
  2. It would probably clear up several open Issues related to tagging Spot instances, e.g. aws_spot_instance_request tags won't apply to instance #32, because you can create and tag a Spot instance in a single API call.

An example of how we have been doing this (outside Terraform) is:

# cat instance.json
{
   ...
   "ImageId": "ami-xyz123",
   "MinCount": 1, 
   "MaxCount": 1, 
   "InstanceMarketOptions": {
      "MarketType": "spot",
      "SpotOptions": {
         "MaxPrice": "0.15",
         "SpotInstanceType": "one-time",
         "InstanceInterruptionBehavior": "terminate"
      }
   },
   "TagSpecifications": [ 
      { "ResourceType": "instance",
        "Tags": [
           { "Key": "Key",    "Value": "Value" }
        ]
      }
   ]
}
# aws ec2 run-instances --cli-input-json file://instance.json

The only difference between running this with Spot Instances vs On-demand instances is the inclusion of a few simple parameters.

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. labels Feb 12, 2018
@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Mar 27, 2020
@ghost
Copy link

ghost commented Jun 13, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Jun 13, 2020
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/ec2 Issues and PRs that pertain to the ec2 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

2 participants