资源编排服务 RFS-AntiDDos.Service:blueprint样例

时间:2024-04-18 10:02:52

blueprint样例

tosca_definitions_version: huaweicloud_tosca_version_1_0
inputs:
  ecs-name:
    default: "my-cloudserver"
    label: E CS 
    description: "虚机名称"
  ecs-image:
    default: "327946b5-e954-42c3-949a-3312688c9269"
    label: ECS
    description: "虚机镜像"
  ecs-flavor:
    default: "c1.medium"
    label: ECS
    description: "虚机规格"
  ecs-volumetype:
    default: SATA
    label: ECS
    description: "虚机磁盘类型"
  ecs-count:
    default: 1
    label: ECS
    description: "虚机数量"
  az:
    default: "cn-north-1a"
    label: ECS
    description: "所在AZ"
  subnet-name:
    default: "my-ecs-subnet2"
    label: ECS
    description: "子网名称"
  subnet-gateway:
    default: "192.168.1.1"
    label: ECS
    description: "子网网关"
  vpc-name:
    default: "my-ecs-vpkvc2"
    label: ECS
    description: "VPC名称"
  vpc-cidr:
    default: "192.168.0.0/16"
    label: ECS
    description: "VPC cidr地址"
  ads-enableL7:  
    type: boolean
    default: true
    label: AntiDDos
    description: "是否启用L7层防护"
  ads-trafficPos:
    type: integer
    default: 9
    label: AntiDDos
    description: "流量分段ID"
  ads-httpRequestPos:
    type: integer
    default: 1
    label: AntiDDos
    description: "HTTP请求数分段ID"
  ads-cleaningAccessPos:
    type: integer
    default: 8
    label: AntiDDos
    description: "清洗时访问限制分段ID"
  ads-appType:
    type: integer
    default: 1
    label: AntiDDos
    description: "应用类型ID"
node_templates:
  my-ecs:
    type: HuaweiCloud.ECS.CloudServer
    properties:
      name: {get_input: ecs-name}
      instances: {get_input: ecs-count}
      imageId: {get_input: ecs-image}
      flavor: {get_input: ecs-flavor}
      vpcId: {get_attribute: [my-subnet, vpcId]}
      availabilityZone: {get_input: az}
      nics:
        - subnetId: {get_attribute: [my-subnet, refID]}
      rootVolume: 
        volumeType: {get_input: ecs-volumetype}
      dataVolumes:
        - volumeType: SATA
          size: 100
      publicIP:
        eip:
          ipType: 5_bgp
          bandwidth:
            size: 100
            shareType: PER
    requirements:
      - nics.subnetId:
          node: my-subnet
  my-subnet:   
    type: HuaweiCloud.VPC.Subnet
    properties:
      name: {get_input: subnet-name}
      cidr: {get_input: vpc-cidr}
      gateway: {get_input: subnet-gateway}
      dnsList: [114.114.114.115, 114.114.114.114]
      vpcId: {get_attribute: [my-vpc,refID]}
      availabilityZone: {get_input: az}
    requirements:
      - vpcId:
          node: my-vpc
  my-vpc:      
    type: HuaweiCloud.VPC.VPC
    properties:
      name: {get_input: vpc-name}
      cidr: {get_input: vpc-cidr}
policies: 
  my-antiddos:
    type: HuaweiCloud.AntiDDos.Service   # 对EIP启用 AntiDDos
    properties:
      enableL7: {get_input: ads-enableL7}
      trafficPos: {get_input: ads-trafficPos}
      httpRequestPos : {get_input: ads-httpRequestPos}
      cleaningAccessPos: {get_input: ads-cleaningAccessPos}
      appType: {get_input: ads-appType}
      floatingIpId: {get_attribute: [my-ecs, floatingIpId]}
    targets: [my-ecs]
outputs:
  ecs-id: 
    value: {get_attribute: [my-ecs, refID]}
    description: "ECS ID"
  vpc-id: 
    value: {get_attribute: [my-vpc, refID]}
    description: "VPC ID"
  subnet-id: 
    value: {get_attribute: [my-subnet, refID]}
    description: "SUBNET ID"
support.huaweicloud.com/tr-aos/antiddos-service.html