amazon.aws
amazon.aws copied to clipboard
ec2_instance: Add support to run spot instances
Summary
It appears that this module lacks a useful ability, as mentioned in the documentation. The recommendation is to use the ec2_spot_instance
module. However, the ec2_spot_instance
module does not support setting the instance metadata option, which is highly needed in some cases. As a result, there is a significant gap in functionality. The options available are to run spot instances using the ec2_spot_instance
module without an adjusted metadata option, or to run instances using the ec2_instance
module that has this feature, but this way, you cannot start spot instances. According to [boto documentation], adding spot support is relatively simple; it just requires adding the InstanceMarketOptions
properties to the build_top_level_options
function.
Issue Type
Feature Idea
Component Name
ec2_instance
Additional Information
I would like to have it like this:
- name: start spot instance with metadata options
amazon.aws.ec2_instance:
name: "spot-metadataoptions-instance"
vpc_subnet_id: subnet-5calable
instance_type: t3.small
image_id: ami-123456
tags:
Environment: Testing
metadata_options:
http_endpoint: enabled
http_tokens: optional
spot_options:
spot_instance_type: 'one-time'
max_price: '0.055'
Code of Conduct
- [X] I agree to follow the Ansible Code of Conduct