All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-RunInstancesWithApproval

Last Updated:Jun 22, 2026

Template name

ACS-ECS-RunInstancesWithApproval: Creates ECS instances upon approval.

Execute now

Template description

Create an ECS instance after approval

Template type

Automation

Owner

Alibaba Cloud

Input parameters

Parameter name

Description

Type

Required

Default value

Constraints

accessToken

The access token for DingTalk.

String

Yes

Must match the regular expression: [A-Za-z0-9]*

imageId

The ID of the image.

String

Yes

instanceType

The instance type.

String

Yes

Must match the regular expression: ecs.[A-Za-z0-9.-]*

securityGroupId

The ID of the security group.

String

Yes

vSwitchId

The ID of the vSwitch.

String

Yes

amount

The number of ECS instances to create.

Number

No

1

OOSAssumeRole

The RAM role assumed by OOS to run the template.

String

No

""

Output parameters

Parameter name

Description

Type

instanceId

String

Required access policy for this template

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

Details

For more information, see Details of ACS-ECS-RunInstancesWithApproval.

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Creates one or more ECS instances with approval
  zh-cn: Creates ECS instances after an approval.
  name-en: ACS-ECS-RunInstancesWithApproval
  name-zh-cn: Create ECS instances after approval
  categories:
    - cost_manage
Parameters:
  accessToken:
    Label:
      en: AccessToken
      zh-cn: DingTalk access token
    Type: String
    AllowedPattern: '[A-Za-z0-9]*'
  imageId:
    Label:
      en: ImageId
      zh-cn: Image ID
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Image::ImageId'
  instanceType:
    Label:
      en: InstanceType
      zh-cn: Instance type
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Instance::InstanceType'
    AllowedPattern: ecs\.[A-Za-z0-9\.\-]*
  securityGroupId:
    Label:
      en: SecurityGroupId
      zh-cn: Security group ID
    Type: String
    AssociationProperty: 'ALIYUN::ECS::SecurityGroup::SecurityGroupId'
  vSwitchId:
    Label:
      en: VSwitchId
      zh-cn: vSwitch ID
    Type: String
    AssociationProperty: 'ALIYUN::VPC::VSwitch::VSwitchId'
    AssociationPropertyMetadata:
      Filters:
        - SecurityGroupId: securityGroupId
  amount:
    Label:
      en: Amount
      zh-cn: Number of instances
    Type: Number
    Default: 1
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: The RAM role that OOS assumes
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: approvalForRunInstances
  Action: ACS::Approve
  Description:
    en: Approval to lunch ECS instances
    zh-cn: DingTalk approval
  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: Create instances
  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: DingTalk Access Token
            en: Dingtalk Access Token
      - Parameters:
          - imageId
          - instanceType
          - securityGroupId
          - vSwitchId
          - amount
        Label:
          default:
            zh-cn: Instance Creation Options
            en: Run Command Options
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Advanced Options
            en: Control Options