Todos os produtos
Search
Central de documentação

CloudOps Orchestration Service:ACS-ESS-LifeCycleAllocateEipAddressAndAttachToInstance

Última atualização: Jun 28, 2026

Aloca e associa EIPs a instâncias ECS durante eventos de scale-out do Auto Scaling usando um lifecycle hook.

Nome do modelo

ACS-ESS-LifeCycleAllocateEipAddressAndAttachToInstance: usa um lifecycle hook para crie um EIP e associá-lo a uma instância.

Executar agora

Descrição do modelo

Usa um lifecycle hook para crie EIPs e associá-los a instâncias ECS. Compatível apenas com eventos de scale-out.

Tipo de modelo

Automatizado

Proprietário

Alibaba Cloud

Parâmetros de entrada

Parâmetro

Descrição

Tipo

Obrigatório

Valor padrão

Limite

internetChargeType

Método de faturamento do EIP.

String

Não

PayByBandwidth

bandwidth

Largura de banda máxima do EIP.

Number

Não

5

regionId

ID da região.

String

Não

${regionId}

instanceIds

IDs das instâncias ECS.

List

Não

['${instanceIds}']

eipTags

Tags do EIP.

Json

Não

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

ISP

Tipo de linha do EIP.

String

Não

BGP

lifecycleHookId

ID do lifecycle hook.

String

Não

${lifecycleHookId}

lifecycleActionToken

Token de ação do ciclo de vida.

String

Não

${lifecycleActionToken}

rateControl

Configurações de controle de taxa.

Json

Não

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

OOSAssumeRole

Função RAM assumida pelo OOS.

String

Não

OOSServiceRole

Parâmetros de saída

Nenhum

Permissões necessárias

{
    "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"
        }
    ]
}

Detalhes

ACS-ESS-LifeCycleAllocateEipAddressAndAttachToInstance

Conteúdo do modelo

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