The content of this article is about how to avoid the need to fill in a large number of configuration parameters every time you create an instance. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you. help.
CreateLaunchTemplate
Create an instance launch template, referred to as a template. Instance launch templates eliminate the need to fill in a large number of configuration parameters every time you create an instance.
Description
The instance startup template contains related configurations for creating instances, such as the region to which the instance belongs, image ID, instance specifications, and security Group ID and public network bandwidth, etc. If an instance configuration is not specified in the template, you need to specify the configuration for the instance when you create it. After creating a template (CreateLaunchTemplate), the initial version of the template is 1. You can subsequently create multiple template versions (CreateLaunchTemplateVersion) based on this version. The version numbers increase sequentially starting from 1. If you do not specify a template version number when creating an instance (RunInstances), the default version will be used.
When calling this interface, you need to note:
You can create up to 30 instance startup templates in a region, and each template can have up to 30 versions.
Most of the parameters of the instance startup template are optional parameters. When creating a template, we will not verify the existence and validity of parameter values in the template. The validity of parameter values will only be verified when the instance is actually created.
If a certain configuration is set in the instance startup template, the configuration cannot be filtered out when creating the instance (RunInstances). For example, if the template sets HostName=LocalHost and the value of HostName in RunInstances is empty, the host name of the instance is still LocalHost. If you want to override the configuration HostName=LocalHost, you can set HostName=MyHost or other parameter values in RunInstances.
Request parameters
##Return parameters
Example
Request Example
https://ecs.aliyuncs.com/?Action=CreateLaunchTemplate &RegionId=cn-hangzhou &LaunchTemplateName=lt-name1 &InstanceType=ecs.cm4.6xlarge &SecurityGroupId=sg-securitygroupid &<公共请求参数>
Return example
XML format
<CreateLaunchTemplateResponse> <RequestId>04F0F334-1335-436C-A1D7-6C044FExxxxx</RequestId> <LaunchTemplateId>lt-m5eiaupmvm2op9dxxxxx</LaunchTemplateId> </CreateLaunchTemplateResponse>
JSON format
{ "RequestId": "04F0F334-1335-436C-A1D7-6C044FExxxxx", "LaunchTemplateId": "lt-m5eiaupmvm2op9dxxxxx" }
Error code
The following are error codes unique to this interface. For more error codes, please visit the API Error Center.The above is the detailed content of How to eliminate the need to fill in a large number of configuration parameters every time you create an instance - Create an instance startup template. For more information, please follow other related articles on the PHP Chinese website!