全部产品
Search
文档中心

CloudOps Orchestration Service:ACS-ESS-LifeCycleAllocateEipAddressAndAttachToInstance

更新时间:Dec 21, 2025

Nama template

ACS-ESS-LifeCycleAllocateEipAddressAndAttachToInstance: Menggunakan kait siklus hidup untuk membuat EIP dan menyambungkannya ke instans

Jalankan Sekarang

Deskripsi template

Menggunakan panggilan balik siklus hidup untuk membuat elastic IP addresses (EIPs) dan mengaitkan EIPs dengan Elastic Compute Service (ECS) instances. Template ini hanya mendukung peristiwa peningkatan skala.

Tipe template

Otomatis

Pemilik

Alibaba Cloud

Parameter input

Parameter

Deskripsi

Tipe

Diperlukan

Nilai default

Batas

internetChargeType

Metode penagihan EIPs.

String

Tidak

PayByBandwidth

bandwidth

Bandwidth puncak dari EIPs.

Number

Tidak

5

regionId

ID wilayah.

String

Tidak

${regionId}

instanceIds

ID Instance ECS.

List

Tidak

['${instanceIds}']

eipTags

Tag EIPs.

Json

Tidak

[{'Key': 'oos_generate', 'Value': '{{ACS::ExecutionId}}'}]

ISP

Jenis jalur EIP.

String

Tidak

BGP

lifecycleHookId

ID kait siklus hidup.

String

Tidak

${lifecycleHookId}

lifecycleActionToken

Pengaturan kontrol laju.

String

Tidak

${lifecycleActionToken}

rateControl

Pengaturan kontrol laju.

Json

Tidak

{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 5}

OOSAssumeRole

Peran Resource Access Management (RAM) yang diasumsikan oleh CloudOps Orchestration Service (OOS).

String

Tidak

OOSServiceRole

Parameter output

Tidak ada

Kebijakan yang diperlukan untuk mengeksekusi template

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:AllocateEipAddress",
                "ecs:AssociateEipAddress",
                "ecs:DescribeEipAddresses",
                "ecs:DescribeInstances",
                "ecs:ReleaseEipAddress",
                "ecs:UnassociateEipAddress"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "vpc:TagResources"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "ess:CompleteLifecycleAction"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Rincian

ACS-ESS-LifeCycleAllocateEipAddressAndAttachToInstance

Isi Template

FormatVersion: OOS-2019-06-01
Description:
  en: Uses a lifecycle hook to create EIPs and attach them to instances. This template supports only scale-out activities.
  name-en: ACS-ESS-LifeCycleAllocateEipAddressAndAttachToInstance
  categories:
    - elastic_manage
Parameters:
  internetChargeType:
    Label:
      en: Billing Method for EIP
    Description:
      en: 'The billing method for the EIP. Valid values: PayByBandwidth (pay-by-bandwidth) and PayByTraffic (pay-by-data-transfer).'
    Type: String
    AllowedValues:
      - PayByBandwidth
      - PayByTraffic
    Default: PayByBandwidth
  bandwidth:
    Label:
      en: EIP Peak Bandwidth
    Description:
      en: The peak bandwidth of the EIP, in Mbit/s.
    Type: Number
    Default: 5
  regionId:
    Label:
      en: Region ID
    Description:
      en: The ID of the region. Use the default value ${regionId} provided by Auto Scaling.
    Type: String
    Default: '${regionId}'
  instanceIds:
    Label:
      en: ECS Instance IDs
    Description:
      en: The IDs of the ECS instances. Use the default value ['${instanceIds}'] provided by Auto Scaling.
    Type: List
    Default:
      - '${instanceIds}'
  eipTags:
    Label:
      en: EIP Tags
    Description:
      en: 'The tags for the EIP. Format: [{"Key":"test1","Value":"test1"},{"Key":"test2","Value":"test2"}, ...].'
    Type: Json
    Default: [{"Key":"oos_generate","Value":"{{ACS::ExecutionId}}"}]
  ISP:
    Label: EIP Line Type
    Description: 'The line type of the EIP. BGP: BGP (Multi-ISP). BGP_PRO: BGP (Multi-ISP) Pro. BGP_International: BGP (International).'
    Type: String
    AllowedValues:
      - BGP
      - BGP_PRO
      - BGP_International
    Default: BGP
  lifecycleHookId:
    Label:
      en: Lifecycle Hook ID
    Description:
      en: The ID of the lifecycle hook. Use the default value ${lifecycleHookId} provided by Auto Scaling.
    Type: String
    Default: '${lifecycleHookId}'
  lifecycleActionToken:
    Label:
      en: Lifecycle Action Token
    Description:
      en: The token for the specific scaling activity that is associated with the instance. Use the default value ${lifecycleActionToken} provided by Auto Scaling.
    Type: String
    Default: '${lifecycleActionToken}'
  rateControl:
    Label:
      en: Rate Control
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 5
  OOSAssumeRole:
    Label:
      en: RAM Role for OOS
    Type: String
    Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: createEipAndAttachToInstance
    Action: 'ACS::ECS::AllocateEipAddressAndAttachToInstance'
    OnSuccess: CompleteLifecycleActionForContinue
    OnError: CompleteLifecycleActionForAbandon
    Description:
      en: Creates an EIP and attaches it to the instance.
    Properties:
      regionId: '{{ regionId }}'
      internetChargeType: '{{ internetChargeType }}'
      bandwidth: '{{ bandwidth }}'
      instanceId: '{{ ACS::TaskLoopItem }}'
      tags: '{{ eipTags }}'
      ISP: '{{ ISP }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ instanceIds }}'
  - Name: CompleteLifecycleActionForContinue
    Action: 'ACS::ExecuteAPI'
    Description:
      en: Sets the lifecycle action to CONTINUE.
    OnSuccess: 'ACS::END'
    Properties:
      Service: ESS
      API: CompleteLifecycleAction
      Parameters:
        RegionId: '{{ regionId }}'
        LifecycleHookId: '{{ lifecycleHookId }}'
        LifecycleActionToken: '{{ lifecycleActionToken }}'
        LifecycleActionResult: CONTINUE
  - Name: CompleteLifecycleActionForAbandon
    Action: 'ACS::ExecuteAPI'
    Description:
      en: Sets the lifecycle action to ABANDON.
    Properties:
      Service: ESS
      API: CompleteLifecycleAction
      Parameters:
        RegionId: '{{ regionId }}'
        LifecycleHookId: '{{ lifecycleHookId }}'
        LifecycleActionToken: '{{ lifecycleActionToken }}'
        LifecycleActionResult: ABANDON