阿里云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)

  

时间: 2024-10-26 03:43:40

阿里云ros实例的相关文章

[转帖]华为鲲鹏云服务器实战:华为云鲲鹏KC1实例 vs. 阿里云G5实例

鲲鹏云服务器实战:华为云鲲鹏KC1实例 vs. 阿里云G5实例 https://m.ithome.com/html/444828.htm 2019-09-12 15:25IT之家 (阿迷) 今年一月份,华为正式发布了鲲鹏920数据中心高性能处理器,该处理器兼容ARM架构,采用7纳米制造,最高支持64核,主频达到2.6GHz,支持八通道DDR4.PCIe 4.0.100G RoCE网络. 华为云基于鲲鹏920处理器的通用计算增强型KC1实例,作为市面上为数不多基于ARM架构的云服务器表现究竟如何,

阿里云服务器实例规格怎么选,阿里云所有实例规格适用场景汇总

现在提到上云服务器,大多用户首先想到的就是阿里云,但是用户在实际购买阿里云服务器的时候却发现阿里云有多大几十种实例规格,对于新手来说,往往就不知道怎么选择了,其实我们可以根据阿里云官方介绍的实例规格所适合的适用场景选择就可以了. 以下表格仅展示了阿里云每个实例规格所适用的场景,更多实例的具体信息(网络收发包能力.处理器等)请参考阿里云帮助中心-实例规格族介绍 以下为阿里云服务器实例规格所对应的适用场景: 实例类型 适用场景 突发性能实例规格族t5 Web应用服务器轻负载应用.微服务开发测试压测服

阿里云RDS实例内不同数据库之间的数据迁移

适用场景 本文适用于使用DTS实现相同实例下库名不同的数据库之间的数据迁移.本文以使用DTS将同一RDS实例下的amptest库迁移到jiangliu_amptest库为例来说明如何使用DTS实现相同实例下库名不同的数据库之间的数据迁移. 说明:当源和目标实例类型不为RDS时,配置流程相同. 环境准备 创建RDS账号,不同的数据库类型,要求的迁移账号权限不同,具体权限要求可以参考产品手册-数据迁移中的相关文档. 在同一RDS实例下创建好amptest数据库以及jiangliu_amptest数据

阿里云数据库实例的一个db被开发人员删除了 如何恢复

1没有 逻辑备份的话. 如下操作即可 可以将那个临时实例的需要导的db用逻辑备份出来恢复到主实例就行了 好多朋友都在问,RDS中把数据恢复到7天内任意时间点的功能在哪里啊? 其实挺简单的,只需要五步操作,为了不影响您的主实例正常运行,在恢复过程中会帮您创建一个临时实例.   一.在RDS控制台中选择“备份与恢复—临时实例—按时间点创建临时实例”:   二.选择过去7天内任意时间点后选择“创建”:   三.这个时候可以在右上角点击查看备份正在恢复中.恢复大概需要10到20分钟左右,具体的恢复时间跟

阿里云服务器无法远程其他的mysql服务器

1.初始化root密码 进入mysql数据库 1 mysql>update user set password=PASSWORD('123456') where User='root'; 2.允许mysql远程访问,可以使用以下三种方式: a.改表. 1 2 3 4 mysql -u root –p mysql>use mysql; mysql>update user set host = '%' where user = 'root'; mysql>select host, us

阿里云 OCS SDK for NodeJS介绍

阿里云技术团队:熊亮 阿里云 SDK for NodeJS 是为 NodeJS 开发者提供使用阿里云各项服务的统一入口,由阿里云UED团队负责开发维护.目前集成了OCS(Memcached), OSS, RDS(MySQL) 三项阿里云服务.代码地址:https://github.com/aliyun-UED/aliyun-sdk-js 使用阿里云 OCS SDK for NodeJS 接入阿里云 OCS 将会变得非常简单.当你通过试用或者购买获得阿里云 OCS 服务的实例,即对应的 ocsKe

阿里云ECS服务器的搭建

之前写了一个Android小项目,然后里面各种与后台数据库的交互,然后差不多完成了吧!感觉应该买一个服务器,而不是每次都是需要启动MyEclipse,启动Tomcat服务器才能够启动服务,获取到数据.那么这次就讲一下阿里云ECS服务器搭建的流程吧! 1. 去阿里云的官网购买服务器,菜单栏的"产品"-->"弹性计算"-->"云服务器ECS" 2. 进去里面购买,分为包年包月 与 按量付费 两种模式,其实价格对于学生党来说还是不算便宜的.

阿里云服务器中centos7 解决wdcp中不能远程访问mysql服务的问题

1.检查mysql是否开启了远程访问的权限 1.1 如果没有授予相应的权限则通过以下命令修改下: GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;//使用root用户从任何主机连接到mysql服务器. 允许某个用户从指定ip的主机连接到mysql服务器 GRANT ALL PRIVILEGES ON *.* TO 'jack'@'10.10.50.127' IDENTIFIED

如何连接Rancher与阿里云NAS存储

阿里云文件存储(Network Attached Storage,简称NAS)是面向阿里云ECS实例.HPC和Docker的文件存储服务,提供标准的文件访问协议,用户无需对现有应用做任何修改,即可使用具备无限容量及性能扩展.单一命名空间.多共享.高可靠和高可用等特性的分布式文件系统. 演示环境说明 整个演示环境由2台阿里云云服务器组成,相关信息说明如下: Rancher环境部署 Rancher环境部署具体部署方法请参考:http://rancher.com/docs/rancher/v1.6/e