阿里云ros实例
模板文件
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"Description": {
"Type": "String",
"Description": "Description of the instance, [2, 256] characters. Do not fill or empty, the default is empty.",
"Default": "msync"
},
"DataDiskName": {
"Type": "String",
"Default": "datadisk"
},
"DataDiskSize": {
"Type": "Number",
"Default": 100
},
"SystemDiskSize": {
"Type": "Number",
"Description": "Disk size of the system disk, range from 40 to 500 GB. If you specify with your own image, make sure the system disk size bigger than image size. ",
"MinValue": 40,
"MaxValue": 500,
"Default": 80
},
"MaxAmount": {
"Type": "Number",
"Description": "Max number of instances to create, should be smaller than 'MaxAmount' and smaller than 100.",
"MinValue": 1,
"MaxValue": 100,
"Default": 1
},
"NetworkType": {
"Type": "String",
"Description": "Instance network type. Support 'vpc' and 'classic', for compatible reason, default is 'classic'. If vswitch id and vpc id is specified, the property will be forced to be set to 'vpc' ",
"Default": "classic"
},
"MinAmount": {
"Type": "Number",
"Description": "Max number of instances to create, should be bigger than 'MinAmount' and smaller than 100.",
"MinValue": 1,
"MaxValue": 100,
"Default": 1
},
"ImageId": {
"Type": "String",
"Description": "Image ID to create ecs instance.",
"Default": "m-2ze5ahokm5p8zeblr3sm"
},
"InstanceType": {
"Type": "String",
"Description": "Ecs instance supported instance type, make sure it should be correct.",
"Default": "ecs.s3.large"
},
"AllocatePublicIP": {
"Type": "Boolean",
"Description": "The public ip for ecs instance, if properties is true, will allocate public ip. If property InternetMaxBandwidthOut set to 0, it will not assign public ip.",
"Default": false
},
"HostName": {
"Type": "String",
"Description": "Host name of created ecs instance. at least 2 characters, and '.' '-' Is not the first and last characters as hostname, not continuous use. Windows platform can be up to 15 characters, allowing letters (without limiting case), numbers and '-', and does not support the number of points, not all is digital ('.').Other (Linux, etc.) platform up to 30 characters, allowing support number multiple points for the period between the points, each permit letters (without limiting case), numbers and '-' components.",
"Default": "ebs-ali-beijing-msync"
},
"Password": {
"Type": "String",
"Description": "Password of created ecs instance. Must contain at least 3 types of special character, lower character, upper character, number.",
"Default": "passwordishere"
},
"IoOptimized": {
"Type": "String",
"Description": "The 'optimized' instance can provide better IO performance. Support 'none' and 'optimized' only, default is 'none'.",
"Default": "optimized"
},
"ZoneId": {
"Type": "String",
"Description": "current zone to create the instance.",
"Default": "cn-beijing-a"
},
"SecurityGroupId": {
"Type": "String",
"Description": "Security group to create ecs instance. For classic instance need the security group not belong to VPC, for VPC instance, please make sure the security group belong to specified VPC.",
"Default": "sg-2zegx612vcgzlkzpydsi"
},
"InternetChargeType": {
"Type": "String",
"Description": "Instance internet access charge type.Support 'PayByBandwidth' and 'PayByTraffic' only. Default is PayByTraffic",
"Default": "PayByBandwidth"
},
"SystemDiskCategory": {
"Type": "String",
"Description": "Category of system disk. Default is cloud.support cloud|cloud_efficiency|cloud_ssd|ephemeral_ssd",
"Default": "cloud_efficiency"
},
"InstanceName": {
"Type": "String",
"Description": "Display name of the instance, [2, 128] English or Chinese characters, must start with a letter or Chinese in size, can contain numbers, '_' or '.', '-'",
"Default": "msync"
},
"InternetMaxBandwidthOut": {
"Type": "Number",
"Description": "Set internet output bandwidth of instance. Unit is Mbps(Mega bit per second). Range is [0,100]. Default is 1.While the property is not 0, public ip will be assigned for instance.",
"MinValue": 0,
"MaxValue": 200,
"Default": 1
},
"InternetMaxBandwidthIn": {
"Type": "Number",
"Description": "Max internet out band width setting, unit in Mbps(Mega bit per second). The range is [1,200], default is 200 Mbps.",
"MinValue": 1,
"MaxValue": 200,
"Default": 200
}
},
"Resources": {
"InstanceGroup": {
"Type": "ALIYUN::ECS::InstanceGroup",
"Properties": {
"Description": {
"Ref": "Description"
},
"DiskMappings": [
{
"Size": {
"Ref": "DataDiskSize"
},
"DiskName": {
"Ref": "DataDiskName"
}
}
],
"SystemDiskSize": {
"Ref": "SystemDiskSize"
},
"MaxAmount": {
"Ref": "MaxAmount"
},
"NetworkType": {
"Ref": "NetworkType"
},
"MinAmount": {
"Ref": "MinAmount"
},
"ImageId": {
"Ref": "ImageId"
},
"InstanceType": {
"Ref": "InstanceType"
},
"AllocatePublicIP": {
"Ref": "AllocatePublicIP"
},
"HostName": {
"Ref": "HostName"
},
"Password": {
"Ref": "Password"
},
"IoOptimized": {
"Ref": "IoOptimized"
},
"ZoneId": {
"Ref": "ZoneId"
},
"SecurityGroupId": {
"Ref": "SecurityGroupId"
},
"InternetChargeType": {
"Ref": "InternetChargeType"
},
"InstanceName": {
"Ref": "InstanceName"
},
"InternetMaxBandwidthOut": {
"Ref": "InternetMaxBandwidthOut"
},
"InternetMaxBandwidthIn": {
"Ref": "InternetMaxBandwidthIn"
}
}
}
},
"Outputs": {
"HostNames": {
"Description": "Host names of created instance.",
"Value": {
"Fn::GetAtt": [
"InstanceGroup",
"HostNames"
]
}
},
"InnerIps": {
"Description": "Inner IP address list of the specified instance. Only for classical instance.",
"Value": {
"Fn::GetAtt": [
"InstanceGroup",
"InnerIps"
]
}
},
"ZoneIds": {
"Description": "Zone id of created instance.",
"Value": {
"Fn::GetAtt": [
"InstanceGroup",
"ZoneIds"
]
}
},
"OrderId": {
"Description": "The order id list of created instance.",
"Value": {
"Fn::GetAtt": [
"InstanceGroup",
"OrderId"
]
}
},
"InstanceIds": {
"Description": "The instance id list of created ecs instance",
"Value": {
"Fn::GetAtt": [
"InstanceGroup",
"InstanceIds"
]
}
}
}
}
代码:
class AliyunROS(object):
def __init__(self, region_id, template_render):
tpl = Environment(loader=FileSystemLoader(searchpath='./')) \
.get_template('msync.template')
template = tpl.render(template_render.get(region_id))
self.region_id = region_id
self.client = AcsClient('aaa', 'bbb', region_id)
self.create_stack_body = '''
{
"Name": "%s",
"TimeoutMins": %d,
"DisableRollback": false,
"Template": %s
}
''' % ('msync_%s' % (time.strftime('%Y%m%d_%H%M%S')), 15, template.encode('utf-8'))
print(self.create_stack_body)
raise SystemExit
def create_ecs_instace(self):
""" :return: {"Id":"String", "Name":"String"} """
req = CreateStacksRequest.CreateStacksRequest()
req.set_headers({'x-acs-region-id': self.region_id})
req.set_content(self.create_stack_body)
return self.client.do_action_with_exception(req)
阿里云ros实例的更多相关文章
- 不服跑个分:ARM鲲鹏云服务器实战评测——华为云鲲鹏KC1实例 vs. 阿里云G5实例【华为云技术分享】
原文链接:https://m.ithome.com/html/444828.htm 今年一月份,华为正式发布了鲲鹏920数据中心高性能处理器,该处理器兼容ARM架构,采用7纳米制造,最高支持64核,主 ...
- [转帖]华为鲲鹏云服务器实战:华为云鲲鹏KC1实例 vs. 阿里云G5实例
鲲鹏云服务器实战:华为云鲲鹏KC1实例 vs. 阿里云G5实例 https://m.ithome.com/html/444828.htm 2019-09-12 15:25IT之家 (阿迷) 今年一月份 ...
- 【故障公告】阿里云 RDS 实例 CPU 100% 故障引发全站无法正常访问
非常抱歉,今天凌晨 3:20~8:30 左右,我们使用的阿里云 RDS 实例 SQL Server 2016 标准版突然出现 CPU 100% 故障,造成全站无法正常访问,由此给您带来巨大的麻烦,请您 ...
- python3 获取阿里云ECS 实例及监控的方法
#!/usr/bin/env python3.5 # -*- coding:utf8 -*- try: import httplib except ImportError: import http.c ...
- 阿里云rds实例恢复到本地
摘要: 前提: 1,阿里云数据库备份实例,恢复数据的时候需要将数据恢复到本地数据库,是不能直接恢复到RDS上的. 2,需要在本地服务器上下载一个数据库,尽量和RDS数据库版本保持一致.(我现在用的是5 ...
- 阿里云RDS实例内不同数据库之间的数据迁移
适用场景 本文适用于使用DTS实现相同实例下库名不同的数据库之间的数据迁移.本文以使用DTS将同一RDS实例下的amptest库迁移到jiangliu_amptest库为例来说明如何使用DTS实现相同 ...
- 阿里云ECS 实例Centos7系统磁盘扩容
需求:一台阿里云的数据盘磁盘空间不足,需要扩容,我这里只有一个主分区,ext4文件系统. 因为磁盘扩容场景不同,阿里云的文档比较全面一些,所以先奉上阿里云的文档,下面开始我的操作步骤: 1.登录控制台 ...
- 阿里云数据库实例的一个db被开发人员删除了 如何恢复
1没有 逻辑备份的话. 如下操作即可 可以将那个临时实例的需要导的db用逻辑备份出来恢复到主实例就行了 好多朋友都在问,RDS中把数据恢复到7天内任意时间点的功能在哪里啊? 其实挺简单的,只需要五步操 ...
- 阿里云 RDS实例间的数据迁移
使用数据传输DTS可以实现两个RDS实例间的数据迁移.对于支持增量迁移的存储引擎,还可以使用DTS在源RDS实例不停服的情况下,将数据迁移到目标RDS实例.目前对于RDS不同存储引擎,只支持同构迁移( ...
随机推荐
- Python slice() 函数
Python slice() 函数 Python 内置函数 描述 slice() 函数实现切片对象,主要用在切片操作函数里的参数传递. 语法 slice 语法: class slice(stop) ...
- jQuery的选择器的总结
一.简单选择器 // $(function () { // $("#box").css("color","red") // }) // 这个 ...
- 微信小程序地图之逆地理编码
首先说一下,我微信自带map的api中并没有相关接口可调用.文中的方法建立于高德地图.(顺便吐槽,微信开发文档相比支付宝家的显得好烂!) 最近做项目用到地图定位相关的需求,为了搞定需求看了下相关的文档 ...
- CentOS7下NFS服务安装及配置
系统环境:CentOS Linux release 7.4.1708 (Core) 3.10.0-693.el7.x86_64 软件版本:nfs-utils-1.3.0-0.48.el7_4.x86_ ...
- 字符编码codecs模块(读写文件)
python对多国语言的处理是支持的很好的,它可以处理现在任意编码的字符,这里深入的研究一下python对多种不同语言的处理.有一点需要清楚的是,当python要做编码转换的时候,会借助于内部的编码, ...
- Sketch插件新利器——使用Mockplus DS制作设计规范
Sketch,作为一款专为图标和界面设计而打造的优质矢量绘图工具,也是设计师们制作和完善公司企业内部设计规范系统不可或缺的设计工具. 然而,逐个导出和上传Sketch编辑优化的设计系统资源费时而费力. ...
- Java程序设计11——异常处理
1 概述 异常机制已经成为判断一门编程语言是否成熟的标准,除了传统的像C语言没有提供异常机制之外,目前主流的编程语言如Java.Ruby.Python都提供了成熟的异常机制.异常机制可以使程序中异常处 ...
- win10自带虚拟机安装CentOS7系统(转)
出处:http://blog.csdn.net/bimabushihaodongxi/article/details/53677490 话说工欲善其事,必先利其器,在我准备学习Linux之前先要完成l ...
- 构建搞性能可扩展asp.net网站文摘
第1章 原则与方法 网页加载的过程: 关注感知性能,减少阻塞调用,减少往返,在所有架构层次采用缓存,优化硬盘I/O 了解浏览器的工作方式,使用ajax,silverlight和纯javascript避 ...
- python sublime run快捷键设置
一.Ctrl+Shift+P进行插件“sublimeREPL”安装 二.打开preferences->Key Binding-User,写入以下内容 [ { "keys": ...