All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-RunInstancesWithApproval

Last Updated:Nov 25, 2024

Template name

ACS-ECS-RunInstancesWithApproval

Execute Now

Template description

Creates Elastic Compute Service (ECS) instances after approval.

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

accessToken

The token that is used to access DingTalk.

String

Yes

Regular expression for string verification: [A-Za-z0-9]*

imageId

The image ID.

String

Yes

instanceType

The instance type of the ECS instances.

String

Yes

Regular expression for string verification: ecs.[A-Za-z0-9.-]*.

securityGroupId

The security group ID.

String

Yes

vSwitchId

The vSwitch ID.

String

Yes

amount

The number of ECS instances to be created.

Number

No

1

OOSAssumeRole

The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS).

String

No

""

Output parameters

Parameter

Description

Type

instanceId

String

Permission policy that is required to execute the template

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:DescribeInstances",
                "ecs:RunInstances"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

References

For more information, see ACS-ECS-RunInstancesWithApproval.yml at GitHub.

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Creates one or more ECS instances with approval
  zh-cn: the description in Chinese
  name-en: ACS-ECS-RunInstancesWithApproval
  name-zh-cn: the description in Chinese
  categories:
    - cost_manage
Parameters:
  accessToken:
    Label:
      en: AccessToken
      zh-cn: the description in Chinese
    Type: String
    AllowedPattern: '[A-Za-z0-9]*'
  imageId:
    Label:
      en: ImageId
      zh-cn: the description in Chinese
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Image::ImageId'
  instanceType:
    Label:
      en: InstanceType
      zh-cn: the description in Chinese
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Instance::InstanceType'
    AllowedPattern: ecs\.[A-Za-z0-9\.\-]*
  securityGroupId:
    Label:
      en: SecurityGroupId
      zh-cn: the description in Chinese
    Type: String
    AssociationProperty: 'ALIYUN::ECS::SecurityGroup::SecurityGroupId'
  vSwitchId:
    Label:
      en: VSwitchId
      zh-cn: the description in Chinese
    Type: String
    AssociationProperty: 'ALIYUN::VPC::VSwitch::VSwitchId'
    AssociationPropertyMetadata:
      Filters:
        - SecurityGroupId: securityGroupId
  amount:
    Label:
      en: Amount
      zh-cn: the description in Chinese
    Type: Number
    Default: 1
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: the description in Chinese
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: approvalForRunInstances
  Action: ACS::Approve
  Description:
    en: Approval to lunch ECS instances
    zh-cn: the description in Chinese
  Properties:
    NotifyType: WebHook
    WebHook:
      URI: https://oapi.dingtalk.com/robot/send?access_token={{ accessToken }}
      Headers:
        Content-Type: application/json
      Content:
        msgtype: text
        text:
          content: The ECS instances will be created
- Name: runInstances
  Action: ACS::ECS::RunInstances
  Description:
    en: Creates one or more ECS instances
    zh-cn: the description in Chinese
  Properties:
    imageId: '{{ imageId }}'
    instanceType: '{{ instanceType }}'
    securityGroupId: '{{ securityGroupId }}'
    vSwitchId: '{{ vSwitchId }}'
    amount: '{{ amount }}'
  Outputs:
    instanceId:
      ValueSelector: instanceIds[0]
      Type: String
Outputs:
  instanceId:
    Type: String
    Value: '{{ runInstances.instanceId }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - accessToken
        Label:
          default:
            zh-cn: the description in Chinese
            en: Dingtalk Access Token
      - Parameters:
          - imageId
          - instanceType
          - securityGroupId
          - vSwitchId
          - amount
        Label:
          default:
            zh-cn: the description in Chinese
            en: Run Command Options
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: the description in Chinese
            en: Control Options