Files
doc-exports/docs/as/dev/en-us_topic_0110252684.html
guoyanyan 6db57a0298 AS DEV 20221025 v2
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: guoyanyan <guoyanyan3@huawei.com>
Co-committed-by: guoyanyan <guoyanyan3@huawei.com>
2022-10-25 11:36:59 +00:00

28 lines
5.7 KiB
HTML

<a name="EN-US_TOPIC_0110252684"></a><a name="EN-US_TOPIC_0110252684"></a>
<h1 class="topictitle1">Performing Operations on Instances in Batches</h1>
<div id="body4139237"><div class="section" id="EN-US_TOPIC_0110252684__section663215"><h4 class="sectiontitle">Scenario</h4><ul id="EN-US_TOPIC_0110252684__ul66842817"><li id="EN-US_TOPIC_0110252684__li64714441">An instance is an ECS in an AS group.</li><li id="EN-US_TOPIC_0110252684__li45559064">Adding Instances to or Removing Instances from an AS Group</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0110252684__section5968939"><h4 class="sectiontitle">Precautions</h4><ul id="EN-US_TOPIC_0110252684__ul66405588"><li id="EN-US_TOPIC_0110252684__li60779388">If you use a token for authentication, you must call the IAM API to obtain the user's token and add <strong id="EN-US_TOPIC_0110252684__b19557811171519">X-Auth-Token</strong> to the request message header of ECS API you call.</li><li id="EN-US_TOPIC_0110252684__li10143581">The validity period of the token obtained from the IAM service is 24 hours. If you want to use a token for authentication, you can cache it to avoid frequently calling the IAM API.</li><li id="EN-US_TOPIC_0110252684__li24183370">The number of instances after the removal must be greater than or equal to the minimum number of instances allowed.</li><li id="EN-US_TOPIC_0110252684__li16323738">The number of instances after the adding must be less than or equal to the maximum number of instances allowed.</li><li id="EN-US_TOPIC_0110252684__li12695920">Instances can be added to an AS group only when the AS group is in the <strong id="EN-US_TOPIC_0110252684__b51986441151945">INSERVICE</strong> state and has no scaling action in progress.</li><li id="EN-US_TOPIC_0110252684__li47154420">You can remove instances from an AS group only when no scaling action is in progress.</li><li id="EN-US_TOPIC_0110252684__li21736599">The instances are removable only when they are in <strong id="EN-US_TOPIC_0110252684__b36026384143513">INSERVICE</strong> state.</li><li id="EN-US_TOPIC_0110252684__li61411666">To add instances to an AS group, ensure that the AZ of the instances must be within the AZ of the AS group and that the instances are in the same VPC as the AS group.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0110252684__section53720453"><h4 class="sectiontitle">Involved APIs</h4><ul id="EN-US_TOPIC_0110252684__ul8289053"><li id="EN-US_TOPIC_0110252684__li7492614">IAM API used to obtain the token</li><li id="EN-US_TOPIC_0110252684__li324668">API used to query AS groups</li><li id="EN-US_TOPIC_0110252684__li2922015">API used to query instances in an AS group</li><li id="EN-US_TOPIC_0110252684__li26298136">API used to query ECSs (native OpenStack API)</li><li id="EN-US_TOPIC_0110252684__li35356632">API used to perform operations on instances in batches</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0110252684__section13722030"><h4 class="sectiontitle">Procedure</h4><ol id="EN-US_TOPIC_0110252684__ol74761340204518"><li id="EN-US_TOPIC_0110252684__li16418192513408">For details about token authentication, see <a href="https://docs.otc.t-systems.com/en-us/api/apiug/apig-en-api-180328003.html" target="_blank" rel="noopener noreferrer">Token Authentication</a>.</li></ol><ol start="2" id="EN-US_TOPIC_0110252684__ol10190321"><li id="EN-US_TOPIC_0110252684__li20109663">Send <strong id="EN-US_TOPIC_0110252684__b641203717184">GET https://</strong><em id="EN-US_TOPIC_0110252684__i443173719186">AS endpoint</em><strong id="EN-US_TOPIC_0110252684__b444173751816">/autoscaling-api/v1/{tenant_id}/scaling_group</strong> to obtain AS groups. Use the ID of one of the AS groups as the URI parameter <strong id="EN-US_TOPIC_0110252684__b18451037181819">scaling_group_id</strong> for querying instances in an AS group. For the response parameters of the API used to query AS groups, see section <a href="en-us_topic_0110252693.html">Response Parameters for Querying AS Groups</a>.</li><li id="EN-US_TOPIC_0110252684__li46769243">Send <strong id="EN-US_TOPIC_0110252684__b388215513194">GET https://</strong><em id="EN-US_TOPIC_0110252684__i3431125951916">AS endpoint</em><strong id="EN-US_TOPIC_0110252684__b3782239205">/autoscaling-api/v1/{tenant_id}/scaling_group_instance/{scaling_group_id}/list</strong> to obtain instances of a specified AS group, such as <strong id="EN-US_TOPIC_0110252684__b1027410147228">instance_id_1</strong> and <strong id="EN-US_TOPIC_0110252684__b38504224221">instance_id_2</strong>. For the response parameters of the API used to query instances of an AS group, see section <a href="en-us_topic_0110252696.html">Response Parameters for Querying Instances in an AS Group</a>.</li><li id="EN-US_TOPIC_0110252684__li30212363">Send <strong id="EN-US_TOPIC_0110252684__b1574512111234">POST https://</strong><em id="EN-US_TOPIC_0110252684__i1710115153231">AS endpoint</em><strong id="EN-US_TOPIC_0110252684__b145131119172310">/autoscaling-api/v1/{tenant_id}/scaling_group_instance/{scaling_group_id}/action</strong> to remove instances from an AS group in batches. For detailed parameters, see section "Performing Operations on Instances in Batches" in the <em id="EN-US_TOPIC_0110252684__i1316311211259">Auto Scaling API Reference</em>.<div class="p" id="EN-US_TOPIC_0110252684__p19646736474">Specify the following parameters in the request body:<pre class="screen" id="EN-US_TOPIC_0110252684__screen89773532382">{
"action": "REMOVE",
"instances_id": [
"instance_id_1",
"instance_id_2"
],
"instance_delete": "yes"
}</pre>
</div>
</li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0110252699.html">Common Operations</a></div>
</div>
</div>