You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ec2_instance: Add support to run spot instances #1338
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.
@alinabuzachis Yes, that works in my case. With some drawbacks, but in general it's applicable. Thanks for highlighting this option! But I still think that adding this ability to ec2_instance module makes sense.
Activity
ansibullbot commentedon Jan 13, 2023
Files identified in the description:
plugins/doc_fragments/tags.py](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws', 'ansible-collections/community.vmware']/blob/main/plugins/doc_fragments/tags.py)plugins/modules/ec2_instance.py](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws', 'ansible-collections/community.vmware']/blob/main/plugins/modules/ec2_instance.py)test/](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws', 'ansible-collections/community.vmware']/blob/main/test/)If these files are inaccurate, please update the
component namesection of the description or use the!componentbot command.click here for bot help
ansibullbot commentedon Jan 13, 2023
cc @jillr @ryansb @s-hertel @tremble
click here for bot help
alinabuzachis commentedon Jan 13, 2023
@tgadiev Thank for for reporting this.
instance_market_optionscan be set by creating an EC2 launch template ( https://github.com/ansible-collections/community.aws/blob/main/plugins/modules/ec2_launch_template.py#L184).You can then feed the launch template to the EC2 instance by specifying the
launch_templateoption https://github.com/ansible-collections/amazon.aws/blob/main/plugins/modules/ec2_instance.py#L223Let me know please if this helps.
tgadiev commentedon Jan 15, 2023
@alinabuzachis Yes, that works in my case. With some drawbacks, but in general it's applicable. Thanks for highlighting this option! But I still think that adding this ability to
ec2_instancemodule makes sense.ci(deps): bump the github-actions group with 7 updates (#3048)
vitabaks commentedon Sep 17, 2026
Are there any updates planned on this issue?