Ali cloud choreography operation and maintenance of new features: a key batch clone ECS

What is cloning?

If you are familiar with virtualization, high probability heard of this cloning function. Clone, VM is the source, generating additional copy one (or more) identical virtual machines.
For ECS user Ali cloud, the clone is a common scenario. For example, when you are experiencing shortage of inventory in the scene of one of the available area, you can choose to clone your ECS batch to another available area. As another example, you already have ECS Hangzhou area now needs to be done off-site disaster recovery, can be cloned ECS Hangzhou to Beijing.
Before Ali cloud OOS choreography operation and maintenance release, cloning ECS is a need for multiple manual steps in the console, namely: ECS log into the console and select Create image, copy the image (optional), create an instance from the mirror , see the official help documentation under the same account of how cloning ECS instance . Because there is no API capabilities atoms, if need automated batch cloning is a very complex development task.

A key batch easily across the region clone

Now, with the ability to OOS choreography operation and maintenance, you can clone a key in the console. If you want to know what is the operation and maintenance schedule, please refer to the article before Ali cloud heavy cloud release automation tool - operation and maintenance scheduling OOS
our example to the two ECS cloned from Shanghai to the US (Silicon Valley).

First of all, please log in OOS console . If you have never opened by OOS service before, please click on the "open" button to open a key. OOS safe operation and maintenance schedule is free service, please rest assured opened.
open.png

OOS is to support cross-regional operation and maintenance operations carried out, we can choose a region, taking into account the efficiency, we have chosen to operate in Shanghai area, find the "ACS-ECS-CloneInstancesAcrossRegion" this common template.
clone1.png

Click on "Create execute" button, select "Customers understand the risks, no confirmation" button, click Next to set parameters.
start.png

Page setting parameters, need to enter the following parameters:
param.png

  • InstanceIds: Batch Enter the instance ID ECS, here we enter both the ID.
  • RegionId:这里指的是已有的源ECS所在的区域的ID,这里是cn-shanghai
  • targetRegionId: 这里是us-west-1
  • targetInstanceType: 您可以输入不同的实例类型进行升级,但是建议和克隆前保持一致
  • targetSecurityGroupId: 目标可用区的安全组ID
  • targetVSwitchId: 目标可用区的交换机ID
  • targetZoneId: 目的可用区的ID,这里我们使用us-west-1a,如果您不知道该用哪个可用区,可以查看DescribeZones官方帮助文档 ,里面有个调试功能,选择可用区,可以直接列出可用区列表。

接下来,进入OOS控制台的执行管理页,查看执行,可以看到图形化的执行过程。

exe.png
由于是跨区域克隆,可能会耗费几分钟时间。执行成功之后,在任务的结果输出您可以看到新克隆的ECS的ID。您也可以在目标区域的ECS控制台看到新生成的ECS。
success.png

如果执行失败,您可以在执行日志里面看到失败的细节原因,常见的原因包括输入的VSwitchId并不在指定的可用区,或者指定可用区暂时不支持售卖输入的实例类型。

进阶:同区域克隆,一个OpenAPI调用完成批量克隆

另外还有一个公共模板,叫做“ACS-ECS-CloneInstancesAcrossAZ”,可以实现同一个区域内的实例,从一个可用区到另一个可用区的复制,您只需要输入InstanceIds,regionId,targetZoneId等信息,点击执行即可。由于省略了跨区域镜像复制的过程,在同一个区域内克隆ECS会更快一些。
如果您想在同一个可用区内克隆ECS,怎么办呢?很简单的,您仍然可以使用“ACS-ECS-CloneInstancesAcrossAZ”这个模板,只不过输入的targetZoneId和当前ECS所在的ZoneId一样就可以了。
如果您觉得公共模板不够好用,有自己的定制化需求怎么办呢?您可以把公共模板“克隆”一份,保存成自己的自定义模板,然后随意编辑,比如,您可以固化一部分参数到您的模板里,这样您下次执行的时候,就不需要输入这么多复杂的参数了。举例来说,您可以从Parameters里面删除“regionId”这一参数,然后把“RegionId: '{{ regionId }}'”这一行,替换为”RegionId: 'cn-shanghai'”。
更进一步,如果您不喜欢逐个instanceid的输入,可以自定义模板,改成通过指定ecs的tag,把包含有指定tag的ecs全部批量克隆。甚至,您可以把账号下在某个region的ecs,全部克隆到另一个region。您可以参考我们的开源模板库 https://github.com/aliyun/oos-templates
如果您想要和自己的运维系统做集成怎么办呢?也比较简单,您可以通过openapi或者sdk触发执行公共模板和自定义模板。API文档:https://help.aliyun.com/document_detail/120771.html
SDK:https://help.aliyun.com/document_detail/120786.html

Help and Support

If you have further needs or for technical support, you can add nails group "OOS choreography operation and maintenance support group," group number 23330931. We have a duty online support.

Link OOS Management Console: https://home.console.aliyun.com/redirect.htm?productId=ecs&path=automation/region/
OOS help the linked document
OOS customer support nail group: 23,330,931

Heavy automatic weapon release Ali cloud cloud - O & M arrangement OOS
permission Fun choreography operation and maintenance services: Assume Role + Pass Role
operation and maintenance scheduling scenarios to ECS series ----- instances are automatically play TAG
operation and maintenance choreography scene Series ---- to copy files from the OSS example
---- SLS was added to the examples set machine operation and maintenance scenario series arrangement

Guess you like

Origin yq.aliyun.com/articles/713348