Tous les produits
Search
Centre de documentation

CloudOps Orchestration Service:ACS-ESS-LifeCycleAllocateEipAddressAndAttachToInstance

Dernière mise à jour :Aug 11, 2026

Alloue et associe des adresses IP élastiques (EIP) aux instances ECS lors des événements de mise à l'échelle ascendante (scale-out) via un hook de cycle de vie.

Nom du modèle

ACS-ESS-LifeCycleAllocateEipAddressAndAttachToInstance : utilise un hook de cycle de vie pour créer une adresse EIP et l'associer à une instance.

Exécuter maintenant

Description du modèle

Utilise un hook de cycle de vie pour créer des adresses EIP et les associer aux instances ECS. Ne prend en charge que les événements de mise à l'échelle ascendante (scale-out).

Type de modèle

Automatisé

Propriétaire

Alibaba Cloud

Paramètres d'entrée

Paramètre

Description

Type

Obligatoire

Valeur par défaut

Limite

internetChargeType

Méthode de facturation de l'EIP.

String

Non

PayByBandwidth

bandwidth

Bande passante maximale de l'EIP.

Number

Non

5

regionId

ID de la région.

String

Non

${regionId}

instanceIds

ID des instances ECS.

List

Non

['${instanceIds}']

eipTags

Tags EIP.

Json

Non

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

ISP

Type de ligne de l'EIP.

String

Non

BGP

lifecycleHookId

ID du hook de cycle de vie.

String

Non

${lifecycleHookId}

lifecycleActionToken

Jeton d'action de cycle de vie

String

Non

${lifecycleActionToken}

rateControl

Paramètres de contrôle de débit.

Json

Non

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

OOSAssumeRole

Rôle RAM utilisé par OOS.

String

Non

OOSServiceRole

Paramètres de sortie

Aucun

Autorisations requises

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

Détails

ACS-ESS-LifeCycleAllocateEipAddressAndAttachToInstance

Contenu du modèle

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