AOS编排语言系列教程(六):创建共享云硬盘EVS

【摘要】 云硬盘(Elastic Volume Service,简称EVS)是一种为ECS、BMS等计算服务提供持久性块存储的服务,通过数据冗余和缓存加速等多项技术,提供高可用性和持久性,以及稳定的低时延性能。您可以对云硬盘做格式化、创建文件系统等操作,并对数据做持久化存储。上一章我们学习了如何创建安全组,接下来我们看看如何在创建的弹性云服务器上挂载共享云硬盘。

tosca_definitions_version: huaweicloud_tosca_version_1_0 
node_templates: 
  myecs: 
    type: HuaweiCloud.ECS.CloudServer 
    properties: 
      availabilityZone: cn-south-1a 
      flavor: c1.medium 
      imageId: a3934478-bfeb-4a02-b257-9089779f0380 
      instances: 1 
      name: my-ecs 
      nics: 
        - subnetId: 
            get_reference: mysubnet 
      rootVolume: 
        size: 40 
        volumeType: SATA 
      securityGroups: 
        - id: 
            get_reference: mysg 
      vpcId: 
        get_reference: myvpc 
      mountedVolumes: 
        - mountPath: '/dev/sdc' 
          volumeId: 
            get_reference: myevs 
    requirements: 
      - vpcId: 
          node: myvpc 
      - securityGroups.id: 
          node: mysg 
      - nics.subnetId: 
          node: mysubnet 
      - mountedVolumes.volumeId: 
          node: myevs 
  mysg: 
    properties: 
      name: my-sg 
    requirements: 
      - vpcId: 
          node: myvpc 
    type: HuaweiCloud.VPC.SecurityGroup 
  mysgrule: 
    type: HuaweiCloud.VPC.SecurityGroupRule 
    properties: 
      direction: ingress 
      ethertype: IPv4 
      maxPort: 5444 
      minPort: 5443 
      protocol: TCP 
      securityGroupId: 
        get_reference: mysg 
    requirements: 
      - securityGroupId: 
          node: mysg 
  mysubnet: 
    type: HuaweiCloud.VPC.Subnet 
    properties: 
      cidr: '192.168.1.0/24' 
      dhcpEnable: true 
      gateway: 192.168.1.1 
      name: my-subnet 
      vpcId: 
        get_reference: myvpc 
    requirements: 
      - vpcId: 
          node: myvpc 
  myvpc: 
    type: HuaweiCloud.VPC.VPC 
    properties: 
      cidr: '192.168.0.0/16' 
      name: my-vpc 
   myevs: 
    type: HuaweiCloud.EVS.SharedVolume 
    properties: 
      size: 10 
      availabilityZone: cn-south-1a 
      volumeType: SATA

模板中定义了一个共享云硬盘myevs,其中size为云硬盘大小,单位为GB;availabilityZone为可用分区;volumeType为云硬盘类型,可选值为SSD、SAS、SATA。

在myecs中增加了mountedVolumes属性,设置了磁盘挂载点mountPath为'/dev/sdc',要挂载的磁盘ID为myevs。

共享云硬盘创建成功:

AOS编排语言系列教程(六):创建共享云硬盘EVS_第1张图片

 来源:华为云社区  作者:tsjsdbd

你可能感兴趣的:(技术交流)