2667-added feature for creating alt types when instance capacity issue occurs and added tests#2677
2667-added feature for creating alt types when instance capacity issue occurs and added tests#2677ritu2593 wants to merge 3 commits intoansible-collections:mainfrom
Conversation
Docs Build 📝Thank you for contribution!✨ The docsite for this PR is available for download as an artifact from this run: You can compare to the docs for the File changes:
Click to see the diff comparison.NOTE: only file modifications are shown here. New and deleted files are excluded. The diff output was truncated because it exceeded the maximum size. diff --git a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/ec2_import_image_info_module.html b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/ec2_import_image_info_module.html
index 7b18013..ffaf8bf 100644
--- a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/ec2_import_image_info_module.html
+++ b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/ec2_import_image_info_module.html
@@ -22,7 +22,7 @@
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="search" title="Search" href="../../../search.html" />
- <link rel="next" title="amazon.aws.ec2_instance module – Create & manage EC2 instances" href="ec2_instance_module.html" />
+ <link rel="next" title="amazon.aws.ec2_instance module" href="ec2_instance_module.html" />
<link rel="prev" title="amazon.aws.ec2_import_image module – Manage AWS EC2 import image tasks" href="ec2_import_image_module.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
@@ -610,7 +610,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-ec2-impo
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="ec2_import_image_module.html" class="btn btn-neutral float-left" title="amazon.aws.ec2_import_image module – Manage AWS EC2 import image tasks" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
- <a href="ec2_instance_module.html" class="btn btn-neutral float-right" title="amazon.aws.ec2_instance module – Create & manage EC2 instances" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
+ <a href="ec2_instance_module.html" class="btn btn-neutral float-right" title="amazon.aws.ec2_instance module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
diff --git a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/ec2_instance_info_module.html b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/ec2_instance_info_module.html
index 9c57faa..aefba3f 100644
--- a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/ec2_instance_info_module.html
+++ b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/ec2_instance_info_module.html
@@ -23,7 +23,7 @@
<script src="../../../_static/js/theme.js"></script>
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="amazon.aws.ec2_key module – Create or delete an EC2 key pair" href="ec2_key_module.html" />
- <link rel="prev" title="amazon.aws.ec2_instance module – Create & manage EC2 instances" href="ec2_instance_module.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
+ <link rel="prev" title="amazon.aws.ec2_instance module" href="ec2_instance_module.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
@@ -1411,7 +1411,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-ec2-inst
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
- <a href="ec2_instance_module.html" class="btn btn-neutral float-left" title="amazon.aws.ec2_instance module – Create & manage EC2 instances" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
+ <a href="ec2_instance_module.html" class="btn btn-neutral float-left" title="amazon.aws.ec2_instance module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="ec2_key_module.html" class="btn btn-neutral float-right" title="amazon.aws.ec2_key module – Create or delete an EC2 key pair" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
diff --git a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/ec2_instance_module.html b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/ec2_instance_module.html
index 4a04ca7..4936a8f 100644
--- a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/ec2_instance_module.html
+++ b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/ec2_instance_module.html
@@ -7,7 +7,7 @@
<meta content="2.22.1" name="antsibull-docs" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>amazon.aws.ec2_instance module – Create & manage EC2 instances — Ansible collections documentation</title>
+ <title>amazon.aws.ec2_instance module — Ansible collections documentation</title>
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=41de9001" />
<link rel="stylesheet" type="text/css" href="../../../_static/css/ansible.css?v=c5b67dd2" />
<link rel="stylesheet" type="text/css" href="../../../_static/antsibull-minimal.css" />
@@ -123,7 +123,7 @@
<li class="breadcrumb-item"><a href="../../index.html">Collection Index</a></li>
<li class="breadcrumb-item"><a href="../index.html">Collections in the Amazon Namespace</a></li>
<li class="breadcrumb-item"><a href="index.html">Amazon.Aws</a></li>
- <li class="breadcrumb-item active">amazon.aws.ec2_instance module – Create & manage EC2 instances</li>
+ <li class="breadcrumb-item active">amazon.aws.ec2_instance module</li>
<li class="wy-breadcrumbs-aside">
<!-- User defined GitHub URL -->
<a href="https://github.com/ansible-collections/amazon.aws/edit/main/plugins/modules/ec2_instance.py?description=%23%23%23%23%23%20SUMMARY%0A%3C!—%20Your%20description%20here%20–%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr" class="fa fa-github"> Edit on GitHub</a>
@@ -136,2319 +136,17 @@
<div itemprop="articleBody">
- <span class="target" id="ansible-collections-amazon-aws-ec2-instance-module"></span><section id="amazon-aws-ec2-instance-module-create-manage-ec2-instances">
-<h1>amazon.aws.ec2_instance module – Create & manage EC2 instances<a class="headerlink" href="#amazon-aws-ec2-instance-module-create-manage-ec2-instances" title="Link to this heading"></a></h1>
-<div class="admonition note">
-<p class="admonition-title">Note</p>
-<p>This module is part of the <a class="reference external" href="https://galaxy.ansible.com/ui/repo/published/amazon/aws/">amazon.aws collection</a> (version 11.0.0-dev0).</p>
-<p>It is not included in <code class="docutils literal notranslate"><span class="pre">ansible-core</span></code>.
-To check whether it is installed, run <code class="code docutils literal notranslate"><span class="pre">ansible-galaxy</span> <span class="pre">collection</span> <span class="pre">list</span></code>.</p>
-<p>To install it, use: <code class="code docutils literal notranslate"><span class="pre">ansible-galaxy</span> <span class="pre">collection</span> <span class="pre">install</span> <span class="pre">amazon.aws</span></code>.
-You need further requirements to be able to use this module,
-see <a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-requirements"><span class="std std-ref">Requirements</span></a> for details.</p>
-<p>To use it in a playbook, specify: <code class="code docutils literal notranslate"><span class="pre">amazon.aws.ec2_instance</span></code>.</p>
-</div>
-<p class="ansible-version-added">New in amazon.aws 1.0.0</p>
-<nav class="contents local" id="contents">
-<ul class="simple">
-<li><p><a class="reference internal" href="#synopsis" id="id3">Synopsis</a></p></li>
-<li><p><a class="reference internal" href="#requirements" id="id4">Requirements</a></p></li>
-<li><p><a class="reference internal" href="#parameters" id="id5">Parameters</a></p></li>
-<li><p><a class="reference internal" href="#notes" id="id6">Notes</a></p></li>
-<li><p><a class="reference internal" href="#examples" id="id7">Examples</a></p></li>
-<li><p><a class="reference internal" href="#return-values" id="id8">Return Values</a></p></li>
-</ul>
-</nav>
-<section id="synopsis">
-<h2><a class="toc-backref" href="#id3" role="doc-backlink">Synopsis</a><a class="headerlink" href="#synopsis" title="Link to this heading"></a></h2>
-<ul class="simple">
-<li><p>Create and manage AWS EC2 instances.</p></li>
-<li><p>This module does not support creating <a class="reference external" href="https://aws.amazon.com/ec2/spot/">EC2 Spot instances</a>.</p></li>
-<li><p>The <a class="reference internal" href="ec2_spot_instance_module.html#ansible-collections-amazon-aws-ec2-spot-instance-module"><span class="std std-ref">amazon.aws.ec2_spot_instance</span></a> module can create and manage spot instances.</p></li>
-</ul>
-</section>
-<section id="requirements">
-<span id="ansible-collections-amazon-aws-ec2-instance-module-requirements"></span><h2><a class="toc-backref" href="#id4" role="doc-backlink">Requirements</a><a class="headerlink" href="#requirements" title="Link to this heading"></a></h2>
-<p>The below requirements are needed on the host that executes this module.</p>
-<ul class="simple">
-<li><p>python >= 3.6</p></li>
-<li><p>boto3 >= 1.34.0</p></li>
-<li><p>botocore >= 1.34.0</p></li>
-</ul>
-</section>
-<section id="parameters">
-<h2><a class="toc-backref" href="#id5" role="doc-backlink">Parameters</a><a class="headerlink" href="#parameters" title="Link to this heading"></a></h2>
-<table class="longtable ansible-option-table docutils align-default" style="width: 100%">
-<thead>
-<tr class="row-odd"><th class="head"><p>Parameter</p></th>
-<th class="head"><p>Comments</p></th>
-</tr>
-</thead>
-<tbody>
-<tr class="row-even"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-aap_callback"></div>
-<div class="ansibleOptionAnchor" id="parameter-tower_callback"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-tower-callback"><span id="ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback"></span><strong>aap_callback</strong></p>
-<a class="ansibleOptionLink" href="#parameter-aap_callback" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-aliases">aliases: tower_callback</span></p>
-<p class="ansible-option-type-line"><span class="ansible-option-type">dictionary</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>Preconfigured user-data to enable an instance to perform an Ansible Automation Platform callback (Linux only).</p>
-<p>For Windows instances, to enable remote access via Ansible set <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback-windows"><span class="std std-ref"><span class="pre">aap_callback.windows</span></span></a></strong></code> to <code class="ansible-value docutils literal notranslate"><span class="pre">true</span></code>, and optionally set an admin password.</p>
-<p>If using <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback-windows"><span class="std std-ref"><span class="pre">aap_callback.windows</span></span></a></strong></code> and <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback-set-password"><span class="std std-ref"><span class="pre">aap_callback.set_password</span></span></a></strong></code>, callback to Ansible Automation Platform will not be performed but the instance will be ready to receive winrm connections from Ansible.</p>
-<p>Mutually exclusive with <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-user-data"><span class="std std-ref"><span class="pre">user_data</span></span></a></strong></code>.</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-aap_callback/host_config_key"></div>
-<div class="ansibleOptionAnchor" id="parameter-tower_callback/host_config_key"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-tower-callback-host-config-key"><span id="ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback-host-config-key"></span><strong>host_config_key</strong></p>
-<a class="ansibleOptionLink" href="#parameter-aap_callback/host_config_key" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Host configuration secret key generated by the Tower job template.</p>
-<p>Required if <code class="ansible-option-value docutils literal notranslate"><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback-windows"><span class="std std-ref"><span class="pre">aap_callback.windows=False</span></span></a></code>.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-aap_callback/job_template_id"></div>
-<div class="ansibleOptionAnchor" id="parameter-tower_callback/job_template_id"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-tower-callback-job-template-id"><span id="ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback-job-template-id"></span><strong>job_template_id</strong></p>
-<a class="ansibleOptionLink" href="#parameter-aap_callback/job_template_id" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Either the integer ID of the Tower Job Template, or the name. Using a name for the job template is not supported by Ansible Tower prior to version 3.2.</p>
-<p>Required if <code class="ansible-option-value docutils literal notranslate"><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback-windows"><span class="std std-ref"><span class="pre">aap_callback.windows=False</span></span></a></code>.</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-aap_callback/set_password"></div>
-<div class="ansibleOptionAnchor" id="parameter-tower_callback/set_password"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-tower-callback-set-password"><span id="ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback-set-password"></span><strong>set_password</strong></p>
-<a class="ansibleOptionLink" href="#parameter-aap_callback/set_password" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Optional admin password to use if <code class="ansible-option-value docutils literal notranslate"><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback-windows"><span class="std std-ref"><span class="pre">aap_callback.windows=True</span></span></a></code>.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-aap_callback/tower_address"></div>
-<div class="ansibleOptionAnchor" id="parameter-tower_callback/tower_address"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-tower-callback-tower-address"><span id="ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback-tower-address"></span><strong>tower_address</strong></p>
-<a class="ansibleOptionLink" href="#parameter-aap_callback/tower_address" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>IP address or DNS name of Tower server. Must be accessible via this address from the VPC that this instance will be launched in.</p>
-<p>Required if <code class="ansible-option-value docutils literal notranslate"><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback-windows"><span class="std std-ref"><span class="pre">aap_callback.windows=False</span></span></a></code>.</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-aap_callback/windows"></div>
-<div class="ansibleOptionAnchor" id="parameter-tower_callback/windows"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-tower-callback-windows"><span id="ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback-windows"></span><strong>windows</strong></p>
-<a class="ansibleOptionLink" href="#parameter-aap_callback/windows" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Set <code class="ansible-option-value docutils literal notranslate"><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-aap-callback-windows"><span class="std std-ref"><span class="pre">aap_callback.windows=True</span></span></a></code> to use powershell instead of bash for the callback script.</p>
-<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
-<ul class="simple">
-<li><p><code class="ansible-option-default-bold docutils literal notranslate"><strong><span class="pre">false</span></strong></code> <span class="ansible-option-choices-default-mark">← (default)</span></p></li>
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">true</span></code></p></li>
-</ul>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-access_key"></div>
-<div class="ansibleOptionAnchor" id="parameter-aws_access_key_id"></div>
-<div class="ansibleOptionAnchor" id="parameter-aws_access_key"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-aws-access-key-id"><span id="ansible-collections-amazon-aws-ec2-instance-module-parameter-aws-access-key"></span><span id="ansible-collections-amazon-aws-ec2-instance-module-parameter-access-key"></span><strong>access_key</strong></p>
-<a class="ansibleOptionLink" href="#parameter-access_key" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-aliases">aliases: aws_access_key_id, aws_access_key</span></p>
-<p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>AWS access key ID.</p>
-<p>See the AWS documentation for more information about access tokens <a class="reference external" href="https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys">https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys</a>.</p>
-<p>The <code class="docutils literal notranslate"><span class="pre">AWS_ACCESS_KEY_ID</span></code> or <code class="docutils literal notranslate"><span class="pre">AWS_ACCESS_KEY</span></code> environment variables may also be used in decreasing order of preference.</p>
-<p>The <em>aws_access_key</em> and <em>profile</em> options are mutually exclusive.</p>
-<p>The <em>aws_access_key_id</em> alias was added in release 5.1.0 for consistency with the AWS botocore SDK.</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-additional_info"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-additional-info"><strong>additional_info</strong></p>
-<a class="ansibleOptionLink" href="#parameter-additional_info" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-<p><em class="ansible-option-versionadded">added in amazon.aws 7.1.0</em></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>Reserved for Amazon’s internal use.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-availability_zone"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-availability-zone"><strong>availability_zone</strong></p>
-<a class="ansibleOptionLink" href="#parameter-availability_zone" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>Specify an availability zone to use the default subnet it. Useful if not specifying the <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-vpc-subnet-id"><span class="std std-ref"><span class="pre">vpc_subnet_id</span></span></a></strong></code> parameter.</p>
-<p>If no subnet, ENI, or availability zone is provided, the default subnet in the default VPC will be used in the first AZ (alphabetically sorted).</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-aws_ca_bundle"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-aws-ca-bundle"><strong>aws_ca_bundle</strong></p>
-<a class="ansibleOptionLink" href="#parameter-aws_ca_bundle" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">path</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>The location of a CA Bundle to use when validating SSL certificates.</p>
-<p>The <code class="docutils literal notranslate"><span class="pre">AWS_CA_BUNDLE</span></code> environment variable may also be used.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-aws_config"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-aws-config"><strong>aws_config</strong></p>
-<a class="ansibleOptionLink" href="#parameter-aws_config" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">dictionary</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>A dictionary to modify the botocore configuration.</p>
-<p>Parameters can be found in the AWS documentation <a class="reference external" href="https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config">https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config</a>.</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-count"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-count"><strong>count</strong></p>
-<a class="ansibleOptionLink" href="#parameter-count" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">integer</span></p>
-<p><em class="ansible-option-versionadded">added in amazon.aws 2.2.0</em></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>Number of instances to launch.</p>
-<p>Setting this value will result in always launching new instances.</p>
-<p>Mutually exclusive with <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-exact-count"><span class="std std-ref"><span class="pre">exact_count</span></span></a></strong></code>.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-cpu_credit_specification"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-cpu-credit-specification"><strong>cpu_credit_specification</strong></p>
-<a class="ansibleOptionLink" href="#parameter-cpu_credit_specification" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>For T series instances, choose whether to allow increased charges to buy CPU credits if the default pool is depleted.</p>
-<p>Choose <code class="ansible-value docutils literal notranslate"><span class="pre">unlimited</span></code> to enable buying additional CPU credits.</p>
-<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
-<ul class="simple">
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">"unlimited"</span></code></p></li>
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">"standard"</span></code></p></li>
-</ul>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-cpu_options"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-cpu-options"><strong>cpu_options</strong></p>
-<a class="ansibleOptionLink" href="#parameter-cpu_options" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">dictionary</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>Reduce the number of vCPU exposed to the instance.</p>
-<p>Those parameters can only be set at instance launch. The two suboptions <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-cpu-options-threads-per-core"><span class="std std-ref"><span class="pre">cpu_options.threads_per_core</span></span></a></strong></code> and <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-cpu-options-core-count"><span class="std std-ref"><span class="pre">cpu_options.core_count</span></span></a></strong></code> are mandatory.</p>
-<p>See <a class="reference external" href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html</a> for combinations available.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-cpu_options/core_count"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-cpu-options-core-count"><strong>core_count</strong></p>
-<a class="ansibleOptionLink" href="#parameter-cpu_options/core_count" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">integer</span> / <span class="ansible-option-required">required</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Set the number of core to enable.</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-cpu_options/threads_per_core"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-cpu-options-threads-per-core"><strong>threads_per_core</strong></p>
-<a class="ansibleOptionLink" href="#parameter-cpu_options/threads_per_core" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">integer</span> / <span class="ansible-option-required">required</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Select the number of threads per core to enable. Disable or Enable Intel HT.</p>
-<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
-<ul class="simple">
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">1</span></code></p></li>
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">2</span></code></p></li>
-</ul>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-debug_botocore_endpoint_logs"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-debug-botocore-endpoint-logs"><strong>debug_botocore_endpoint_logs</strong></p>
-<a class="ansibleOptionLink" href="#parameter-debug_botocore_endpoint_logs" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>Use a <code class="docutils literal notranslate"><span class="pre">botocore.endpoint</span></code> logger to parse the unique (rather than total) <code class="docutils literal notranslate"><span class="pre">"resource:action"</span></code> API calls made during a task, outputing the set to the resource_actions key in the task results. Use the <code class="docutils literal notranslate"><span class="pre">aws_resource_action</span></code> callback to output to total list made during a playbook.</p>
-<p>The <code class="docutils literal notranslate"><span class="pre">ANSIBLE_DEBUG_BOTOCORE_LOGS</span></code> environment variable may also be used.</p>
-<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
-<ul class="simple">
-<li><p><code class="ansible-option-default-bold docutils literal notranslate"><strong><span class="pre">false</span></strong></code> <span class="ansible-option-choices-default-mark">← (default)</span></p></li>
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">true</span></code></p></li>
-</ul>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-detailed_monitoring"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-detailed-monitoring"><strong>detailed_monitoring</strong></p>
-<a class="ansibleOptionLink" href="#parameter-detailed_monitoring" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>Whether to allow detailed CloudWatch metrics to be collected, enabling more detailed alerting.</p>
-<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
-<ul class="simple">
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">false</span></code></p></li>
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">true</span></code></p></li>
-</ul>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-ebs_optimized"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-ebs-optimized"><strong>ebs_optimized</strong></p>
-<a class="ansibleOptionLink" href="#parameter-ebs_optimized" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>Whether instance is should use optimized EBS volumes, see <a class="reference external" href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html</a>.</p>
-<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
-<ul class="simple">
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">false</span></code></p></li>
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">true</span></code></p></li>
-</ul>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-endpoint_url"></div>
-<div class="ansibleOptionAnchor" id="parameter-aws_endpoint_url"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-endpoint-url"><span id="ansible-collections-amazon-aws-ec2-instance-module-parameter-aws-endpoint-url"></span><strong>endpoint_url</strong></p>
-<a class="ansibleOptionLink" href="#parameter-endpoint_url" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-aliases">aliases: aws_endpoint_url</span></p>
-<p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>URL to connect to instead of the default AWS endpoints. While this can be used to connection to other AWS-compatible services the amazon.aws and community.aws collections are only tested against AWS.</p>
-<p>The <code class="docutils literal notranslate"><span class="pre">AWS_URL</span></code> environment variable may also be used.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-exact_count"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-exact-count"><strong>exact_count</strong></p>
-<a class="ansibleOptionLink" href="#parameter-exact_count" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">integer</span></p>
-<p><em class="ansible-option-versionadded">added in amazon.aws 2.2.0</em></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>An integer value which indicates how many instances that match the <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-filters"><span class="std std-ref"><span class="pre">filters</span></span></a></strong></code> parameter should be running.</p>
-<p>Instances are either created or terminated based on this value.</p>
-<p>If termination takes place, least recently created instances will be terminated based on Launch Time.</p>
-<p>Mutually exclusive with <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-count"><span class="std std-ref"><span class="pre">count</span></span></a></strong></code>, <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-instance-ids"><span class="std std-ref"><span class="pre">instance_ids</span></span></a></strong></code>.</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-filters"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-filters"><strong>filters</strong></p>
-<a class="ansibleOptionLink" href="#parameter-filters" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">dictionary</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>A dict of filters to apply when deciding whether existing instances match and should be altered. Each dict item consists of a filter key and a filter value. See <a class="reference external" href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html">https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html</a>. for possible filters. Filter names and values are case sensitive.</p>
-<p>By default, instances are filtered for counting by their “Name” tag, base AMI, state (running, by default), and subnet ID. Any queryable filter can be used. Good candidates are specific tags, SSH keys, or security groups.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-hibernation_options"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-hibernation-options"><strong>hibernation_options</strong></p>
-<a class="ansibleOptionLink" href="#parameter-hibernation_options" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
-<p><em class="ansible-option-versionadded">added in amazon.aws 5.0.0</em></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>Indicates whether an instance is enabled for hibernation. Refer <a class="reference external" href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hibernating-prerequisites.html">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hibernating-prerequisites.html</a> for Hibernation prerequisits.</p>
-<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
-<ul class="simple">
-<li><p><code class="ansible-option-default-bold docutils literal notranslate"><strong><span class="pre">false</span></strong></code> <span class="ansible-option-choices-default-mark">← (default)</span></p></li>
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">true</span></code></p></li>
-</ul>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-iam_instance_profile"></div>
-<div class="ansibleOptionAnchor" id="parameter-instance_role"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-instance-role"><span id="ansible-collections-amazon-aws-ec2-instance-module-parameter-iam-instance-profile"></span><strong>iam_instance_profile</strong></p>
-<a class="ansibleOptionLink" href="#parameter-iam_instance_profile" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-aliases">aliases: instance_role</span></p>
-<p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>The ARN or name of an EC2-enabled IAM instance profile to be used.</p>
-<p>If a name is not provided in ARN format then the ListInstanceProfiles permission must also be granted. <a class="reference external" href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListInstanceProfiles.html">https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListInstanceProfiles.html</a></p>
-<p>If no full ARN is provided, the role with a matching name will be used from the active AWS account.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-image"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-image"><strong>image</strong></p>
-<a class="ansibleOptionLink" href="#parameter-image" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">dictionary</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>An image to use for the instance. The <a class="reference internal" href="ec2_ami_info_module.html#ansible-collections-amazon-aws-ec2-ami-info-module"><span class="std std-ref">amazon.aws.ec2_ami_info</span></a> module may be used to retrieve images. One of <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-image"><span class="std std-ref"><span class="pre">image</span></span></a></strong></code> or <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#id1"><span class="std std-ref"><span class="pre">image_id</span></span></a></strong></code> are required when instance is not already present.</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-image/id"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-image-id"><strong>id</strong></p>
-<a class="ansibleOptionLink" href="#parameter-image/id" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>The AMI ID.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-image/kernel"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-image-kernel"><strong>kernel</strong></p>
-<a class="ansibleOptionLink" href="#parameter-image/kernel" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>a string AKI to override the AMI kernel.</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-image/ramdisk"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-image-ramdisk"><strong>ramdisk</strong></p>
-<a class="ansibleOptionLink" href="#parameter-image/ramdisk" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Overrides the AMI’s default ramdisk ID.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-image_id"></div><p class="ansible-option-title" id="id1"><strong>image_id</strong></p>
-<a class="ansibleOptionLink" href="#parameter-image_id" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p><em>ami</em> ID to use for the instance. One of <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-image"><span class="std std-ref"><span class="pre">image</span></span></a></strong></code> or <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#id1"><span class="std std-ref"><span class="pre">image_id</span></span></a></strong></code> are required when instance is not already present.</p>
-<p>This is an alias for <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-image-id"><span class="std std-ref"><span class="pre">image.id</span></span></a></strong></code>.</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-instance_ids"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-instance-ids"><strong>instance_ids</strong></p>
-<a class="ansibleOptionLink" href="#parameter-instance_ids" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">list</span> / <span class="ansible-option-elements">elements=string</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>If you specify one or more instance IDs, only instances that have the specified IDs are returned.</p>
-<p>Mutually exclusive with <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-exact-count"><span class="std std-ref"><span class="pre">exact_count</span></span></a></strong></code>.</p>
-<p class="ansible-option-line"><strong class="ansible-option-default-bold">Default:</strong> <code class="ansible-option-default docutils literal notranslate"><span class="pre">[]</span></code></p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-instance_initiated_shutdown_behavior"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-instance-initiated-shutdown-behavior"><strong>instance_initiated_shutdown_behavior</strong></p>
-<a class="ansibleOptionLink" href="#parameter-instance_initiated_shutdown_behavior" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>Whether to stop or terminate an instance upon shutdown.</p>
-<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
-<ul class="simple">
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">"stop"</span></code></p></li>
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">"terminate"</span></code></p></li>
-</ul>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-instance_type"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-instance-type"><strong>instance_type</strong></p>
-<a class="ansibleOptionLink" href="#parameter-instance_type" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>Instance type to use for the instance, see <a class="reference external" href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html</a>.</p>
-<p>At least one of <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-instance-type"><span class="std std-ref"><span class="pre">instance_type</span></span></a></strong></code> or <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-launch-template"><span class="std std-ref"><span class="pre">launch_template</span></span></a></strong></code> must be specificed when launching an instance.</p>
-<p>When the instance is present and the <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-instance-type"><span class="std std-ref"><span class="pre">instance_type</span></span></a></strong></code> specified value is different from the current value, the instance will be stopped and the instance type will be updated.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-key_name"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-key-name"><strong>key_name</strong></p>
-<a class="ansibleOptionLink" href="#parameter-key_name" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>Name of the SSH access key to assign to the instance - must exist in the region the instance is created.</p>
-<p>Use <a class="reference internal" href="ec2_key_module.html#ansible-collections-amazon-aws-ec2-key-module"><span class="std std-ref">amazon.aws.ec2_key</span></a> to manage SSH keys.</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-launch_template"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-launch-template"><strong>launch_template</strong></p>
-<a class="ansibleOptionLink" href="#parameter-launch_template" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">dictionary</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>The EC2 launch template to base instance configuration on.</p>
-<p>At least one of <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-instance-type"><span class="std std-ref"><span class="pre">instance_type</span></span></a></strong></code> or <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-launch-template"><span class="std std-ref"><span class="pre">launch_template</span></span></a></strong></code> must be specificed when launching an instance.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-launch_template/id"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-launch-template-id"><strong>id</strong></p>
-<a class="ansibleOptionLink" href="#parameter-launch_template/id" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>The ID of the launch template (optional if name is specified).</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-launch_template/name"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-launch-template-name"><strong>name</strong></p>
-<a class="ansibleOptionLink" href="#parameter-launch_template/name" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>The pretty name of the launch template (optional if id is specified).</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-launch_template/version"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-launch-template-version"><strong>version</strong></p>
-<a class="ansibleOptionLink" href="#parameter-launch_template/version" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>The specific version of the launch template to use. If unspecified, the template default is chosen.</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-license_specifications"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-license-specifications"><strong>license_specifications</strong></p>
-<a class="ansibleOptionLink" href="#parameter-license_specifications" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">list</span> / <span class="ansible-option-elements">elements=dictionary</span></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>The license specifications to be used for the instance.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-license_specifications/license_configuration_arn"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-license-specifications-license-configuration-arn"><strong>license_configuration_arn</strong></p>
-<a class="ansibleOptionLink" href="#parameter-license_specifications/license_configuration_arn" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span> / <span class="ansible-option-required">required</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>The Amazon Resource Name (ARN) of the license configuration.</p>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-metadata_options"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-metadata-options"><strong>metadata_options</strong></p>
-<a class="ansibleOptionLink" href="#parameter-metadata_options" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">dictionary</span></p>
-<p><em class="ansible-option-versionadded">added in amazon.aws 2.0.0</em></p>
-</div></td>
-<td><div class="ansible-option-cell"><p>Modify the metadata options for the instance.</p>
-<p>See <a class="reference external" href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html</a> for more information.</p>
-<p>The two suboptions <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-metadata-options-http-endpoint"><span class="std std-ref"><span class="pre">metadata_options.http_endpoint</span></span></a></strong></code> and <code class="ansible-option docutils literal notranslate"><strong><a class="reference internal" href="#ansible-collections-amazon-aws-ec2-instance-module-parameter-metadata-options-http-tokens"><span class="std std-ref"><span class="pre">metadata_options.http_tokens</span></span></a></strong></code> are supported.</p>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-metadata_options/http_endpoint"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-metadata-options-http-endpoint"><strong>http_endpoint</strong></p>
-<a class="ansibleOptionLink" href="#parameter-metadata_options/http_endpoint" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Enables or disables the HTTP metadata endpoint on instances.</p>
-<p>If specified a value of disabled, metadata of the instance will not be accessible.</p>
-<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
-<ul class="simple">
-<li><p><code class="ansible-option-default-bold docutils literal notranslate"><strong><span class="pre">"enabled"</span></strong></code> <span class="ansible-option-choices-default-mark">← (default)</span></p></li>
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">"disabled"</span></code></p></li>
-</ul>
-</div></td>
-</tr>
-<tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-metadata_options/http_protocol_ipv6"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-metadata-options-http-protocol-ipv6"><strong>http_protocol_ipv6</strong></p>
-<a class="ansibleOptionLink" href="#parameter-metadata_options/http_protocol_ipv6" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
-<p><em class="ansible-option-versionadded">added in amazon.aws 4.0.0</em></p>
-</div></td>
-<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Whether the instance metadata endpoint is available via IPv6 (<code class="ansible-value docutils literal notranslate"><span class="pre">enabled</span></code>) or not (<code class="ansible-value docutils literal notranslate"><span class="pre">disabled</span></code>).</p>
-<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
-<ul class="simple">
-<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">"enabled"</span></code></p></li>
-<li><p><code class="ansible-option-default-bold docutils literal notranslate"><strong><span class="pre">"disabled"</span></strong></code> <span class="ansible-option-choices-default-mark">← (default)</span></p></li>
-</ul>
-</div></td>
-</tr>
-<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
-<div class="ansibleOptionAnchor" id="parameter-metadata_options/http_put_response_hop_limit"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-instance-module-parameter-metadata-options-http-put-response-hop-limit"><strong>http_put_response_hop_limit</strong></p>
-<a class="ansibleOptionLink" href="#parameter-metadata_options |
|
@tremble Can you please review this? I would like some more reviews from other members as well. |
tremble
left a comment
There was a problem hiding this comment.
Not had chance to go through this properly (sorry I've a bunch of stuff going on at the minute). I've tried to get at least some comments in here so you've got some feedback.
plugins/modules/ec2_instance.py
Outdated
| instance_types_to_try.extend(alternate_instance_types) | ||
|
|
||
| # If no instance types to try, fallback to original behavior | ||
| if not instance_types_to_try: |
There was a problem hiding this comment.
I'm not a big fan of splitting this into a special case. If we have two separate code paths, then we've got two places that mistakes can creep in.
plugins/modules/ec2_instance.py
Outdated
| except Exception as e: | ||
| # For any other error, re-raise immediately | ||
| raise |
There was a problem hiding this comment.
No need to catch this. We need the "else ; raise" in the previous lines because we've already caught the exception.
There was a problem hiding this comment.
This is for other errors apart from InsufficientInstanceCapacity and Invalid IAM Instance Profile ARN. It will fail and catching it is not mandatory, but good to have.
|
|
||
| last_error = None | ||
|
|
||
| for i, instance_type in enumerate(instance_types_to_try): |
There was a problem hiding this comment.
There's something I don't like about the copy and copy and paste here, especially with the extra logic, but can't put my finger on it...
There was a problem hiding this comment.
This ensures each retry attempt gets a clean, unmodified specification with only the instance type changed, while preserving the original spec for potential future use.
|
@tremble Hi Mark, May I know who are the owners of this repo. I think we need to fix the main branch because checks fail for most PR's. Can you please guide on how can we go about it? And any way to expedite reviews? |
plugins/modules/ec2_instance.py
Outdated
| - Only used when launching new instances, not when modifying existing instances. | ||
| type: list | ||
| elements: str | ||
| version_added: 8.3.0 |
There was a problem hiding this comment.
| version_added: 8.3.0 | |
| version_added: 10.2.0 |
| return result | ||
|
|
||
| except AnsibleAWSError as e: | ||
| except is_ansible_aws_error_message("Invalid IAM Instance Profile ARN"): |
There was a problem hiding this comment.
When a new Ec2 is created, the instance profile attachment could take time, So this exception is ignored and ec2 operation is retried.
| # to be visible by EC2. Wait 10 seconds and retry with the same instance type | ||
| time.sleep(10) | ||
| try: | ||
| result = run_ec2_instances(client, **current_spec) |
There was a problem hiding this comment.
This part of the code is repeated
There was a problem hiding this comment.
When a new Ec2 is created, the instance profile attachment could take time, So this exception is ignored and ec2 operation is retried. Its repeated because its in the exception block and we want to retry the operation when the exception is for invalid instance profile
There was a problem hiding this comment.
Can the duplicate code be copied out into a small function which can be called a second time if the exception occurs?
|
|
||
| for i, instance_type in enumerate(instance_types_to_try): | ||
| # Create a copy of the instance spec with the current instance type to maintain original values | ||
| current_spec = copy.deepcopy(instance_spec) |
There was a problem hiding this comment.
Wouldn’t a shallow copy be sufficient here?
There was a problem hiding this comment.
I have tried with deepcopy and I dont think there would be much of a time difference. Since multiple instance types are tried, I want detailed copy to be done.
|
Hi @ritu2593 thanks for submitting this PR. Could you please rebase your branch so that the sanity and unit test failures are resolved? Also, kindly add a changelog fragment explaining the changes. |
…e occurs and added tests
…e occurs and added tests
SUMMARY
Adds feature for ec2_instance to retry with alternate instance types when instance insufficient capacity issue occurs
#2667
ISSUE TYPE
COMPONENT NAME
amazon.aws.ec2_instance
ADDITIONAL INFORMATION
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/troubleshooting-launch.html#troubleshooting-launch-capacity
This PR resolves #2667