Files
doc-exports/docs/as/dev/en-us_topic_0110252701.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

44 lines
6.4 KiB
HTML

<a name="EN-US_TOPIC_0110252701"></a><a name="EN-US_TOPIC_0110252701"></a>
<h1 class="topictitle1">Creating an AS Group</h1>
<div id="body36818163"><div class="section" id="EN-US_TOPIC_0110252701__section50663857"><h4 class="sectiontitle">Scenario</h4><p id="EN-US_TOPIC_0110252701__p169406482239">An AS group consists of a collection of instances that apply to the same scenario. It is the basis for enabling or disabling AS policies and performing scaling actions.</p>
</div>
<div class="section" id="EN-US_TOPIC_0110252701__section53321536"><h4 class="sectiontitle">Precautions</h4><ul id="EN-US_TOPIC_0110252701__ul16949880"><li id="EN-US_TOPIC_0110252701__li18331200">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_0110252701__b178523532612">X-Auth-Token</strong> to the request message header of ECS API you call.</li><li id="EN-US_TOPIC_0110252701__li30763078">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.<p id="EN-US_TOPIC_0110252701__p8432251"><a name="EN-US_TOPIC_0110252701__li30763078"></a><a name="li30763078"></a></p>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0110252701__section10131777"><h4 class="sectiontitle">Involved APIs</h4><ul id="EN-US_TOPIC_0110252701__ul11923743"><li id="EN-US_TOPIC_0110252701__li40204823">IAM API used to obtain the token</li><li id="EN-US_TOPIC_0110252701__li26299090">API used to query VPCs</li><li id="EN-US_TOPIC_0110252701__li35365226">API used to query subnets</li><li id="EN-US_TOPIC_0110252701__li49851583">API used to query security groups</li><li id="EN-US_TOPIC_0110252701__li46011066">API used to query AS configurations</li><li id="EN-US_TOPIC_0110252701__li11446412">API used to create an AS group</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0110252701__section24077135"><h4 class="sectiontitle">Procedure</h4><ol id="EN-US_TOPIC_0110252701__ol54744161"><li id="EN-US_TOPIC_0110252701__li481592752418">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><li id="EN-US_TOPIC_0110252701__li18630676">Send <strong id="EN-US_TOPIC_0110252701__b822054055011">GET https://</strong><em id="EN-US_TOPIC_0110252701__i47401551165012">VPC endpoint</em><strong id="EN-US_TOPIC_0110252701__b113321945205011">/v1/{tenant_id}/vpcs</strong> to obtain VPCs. Use the ID of one of the obtained VPCs as parameter <strong id="EN-US_TOPIC_0110252701__b568425353210">vpc_id</strong> for creating an AS group, such as <strong id="EN-US_TOPIC_0110252701__b3485162113338">a8327883-6b07-4497-9c61-68d03ee193</strong>. For the response parameters of the API used to query VPCs, see section <a href="en-us_topic_0110252686.html">Response Parameters for Querying VPCs</a>.</li><li id="EN-US_TOPIC_0110252701__li33458356">Send <strong id="EN-US_TOPIC_0110252701__b4776208514">GET https://</strong><em id="EN-US_TOPIC_0110252701__i94287584345">VPC endpoint</em><strong id="EN-US_TOPIC_0110252701__b11317171335116"> /v1/{tenant_id}/security-groups</strong> to obtain security groups. Use one of the obtained security groups as parameter <strong id="EN-US_TOPIC_0110252701__b7821164017358">security_groups</strong> for creating an AS group. For the response parameters of the API used to query security groups, see section <a href="en-us_topic_0110252688.html">Response Parameters for Querying Security Groups</a>.</li><li id="EN-US_TOPIC_0110252701__li32689751">Send <strong id="EN-US_TOPIC_0110252701__b194503795112">GET https://</strong><em id="EN-US_TOPIC_0110252701__i94042016371">VPC endpoint</em><strong id="EN-US_TOPIC_0110252701__b12534135412511"> /v1/{tenant_id}/subnets?vpc_id=a8327883-6b07-4497-9c61-68d03ee193a</strong> to obtain subnets in a specified VPC. For the response parameters of the API used to query subnets, see section <a href="en-us_topic_0110252687.html">Response Parameters for Querying Subnets</a>.</li><li id="EN-US_TOPIC_0110252701__li25772311">Send <strong id="EN-US_TOPIC_0110252701__b123931131525">GET https://</strong><em id="EN-US_TOPIC_0110252701__i10201114333818">AS endpoint</em><strong id="EN-US_TOPIC_0110252701__b3742618145216">/autoscaling-api/v1/{tenant_id}/scaling_configuration</strong> to obtain AS configurations. Use the ID of one of the obtained AS configurations as parameter <strong id="EN-US_TOPIC_0110252701__b1608918193914">scaling_configuration_id</strong> for creating an AS group. For the response parameters of the API used to query AS configurations, see section <a href="en-us_topic_0110252695.html">Response Parameters for Querying AS Configurations</a>.</li><li id="EN-US_TOPIC_0110252701__li30624212">Send <strong id="EN-US_TOPIC_0110252701__b175959352526">POST https://</strong><em id="EN-US_TOPIC_0110252701__i757704813403">AS endpoint</em><strong id="EN-US_TOPIC_0110252701__b1413942195213">/autoscaling-api/v1/{tenant_id}/scaling_group</strong> to create an AS group. For detailed parameters, see section "Creating an AS Group" in the <em id="EN-US_TOPIC_0110252701__i10231028174012">Auto Scaling API Reference</em>.<div class="p" id="EN-US_TOPIC_0110252701__p177041233194620">Specify the following parameters in the request body:<pre class="screen" id="EN-US_TOPIC_0110252701__screen128761151194017">{
"scaling_group_name": "as-group-test",
"scaling_configuration_id": "47683a91-93ee-462a-a7d7-484c006f4440",
"desire_instance_number": 0,
"min_instance_number": 0,
"max_instance_number": 10,
"cool_down_time": 300,
"health_periodic_audit_method": "NOVA_AUDIT",
"health_periodic_audit_time": 5,
"instance_terminate_policy": "OLD_CONFIG_OLD_INSTANCE",
"vpc_id": "a8327883-6b07-4497-9c61-68d03ee193a",
"networks": [
{
"id": "3cd35bca-5a10-416f-8994-f79169559870"
}
],
"security_groups": [
{
"id": "23b7b999-0a30-4b48-ae8f-ee201a88a6ab"
}
]
}</pre>
</div>
<p id="EN-US_TOPIC_0110252701__p546673717463"><strong id="EN-US_TOPIC_0110252701__b139830184420">scaling_group_id</strong> is returned if the request is successful.</p>
</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>