すべてのプロダクト
Search
ドキュメントセンター

CloudOps Orchestration Service:ACS-ESS-LifeCycleCreateNetworkInterfaceAndEipAndAttachToInstance

最終更新日:Sep 10, 2026

Auto Scaling のスケールアウトイベント中にライフサイクルセーフティフックを介して Elastic Network Interface (ENI) と Elastic IP アドレス (EIP) を作成し、それらを ECS インスタンスにアタッチします。

テンプレート名

ACS-ESS-LifeCycleCreateNetworkInterfaceAndEipAndAttachToInstance は、ライフサイクルセーフティフックを使用して ENI と EIP を作成し、ENI をインスタンスにアタッチします。

Execute Now

テンプレートの説明

ライフサイクルセーフティフックを介して ENI と EIP を作成し、ECS インスタンスに関連付けます。インスタンスが CentOS 7.3 64 ビット以降、CentOS 6.8 64 ビット以降、または Windows Server 2008 R2 以降のイメージを使用していない場合、ENI を手動で設定する必要があります。詳細については、「Elastic Network Interfaces」をご参照ください。このテンプレートは、スケールアウトイベントのみをサポートします。

テンプレートタイプ

自動

所有者

Alibaba Cloud

入力パラメーター

パラメーター

説明

タイプ

必須

デフォルト値

制限

OOSAssumeRole

Operation Orchestration Service (OOS) が引き受ける RAM ロール。

String

はい

internetChargeType

EIP の課金方法。

String

いいえ

PayByBandwidth

bandwidth

EIP のピーク帯域幅。

Number

いいえ

5

regionId

リージョン ID。

String

いいえ

${regionId}

instanceIds

ECS インスタンス ID のリスト。

List

いいえ

['${instanceIds}']

lifecycleHookId

ライフサイクルセーフティフックの ID。

String

いいえ

${lifecycleHookId}

lifecycleActionToken

インスタンスに関連付けられている特定のスケーリングアクティビティのトークン。

String

いいえ

${lifecycleActionToken}

rateControl

レートコントロール設定。

Json

いいえ

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

出力パラメーター

なし

テンプレートの実行に必要なポリシー

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:AllocateEipAddress",
                "ecs:AssociateEipAddress",
                "ecs:AttachNetworkInterface",
                "ecs:CreateNetworkInterface",
                "ecs:DeleteNetworkInterface",
                "ecs:DescribeEipAddresses",
                "ecs:DescribeInstances",
                "ecs:DescribeInvocationResults",
                "ecs:DescribeInvocations",
                "ecs:DescribeNetworkInterfaces",
                "ecs:DetachNetworkInterface",
                "ecs:ReleaseEipAddress",
                "ecs:RunCommand"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "ess:CompleteLifecycleAction"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

詳細

ACS-ESS-LifeCycleCreateNetworkInterfaceAndEipAndAttachToInstance

テンプレートの内容

FormatVersion: OOS-2019-06-01
Description:
  en: Use a lifecycle hook to create an Elastic Network Interface (ENI) and an Elastic IP Address (EIP) and attach them to an ECS instance. The ENI requires no configuration for instances that use CentOS 7.3 64-bit, CentOS 6.8 64-bit, or Windows Server 2008 R2 and later images. For other images, configure the ENI by following the instructions in the official documentation at https://www.alibabacloud.com/help/document_detail/56955.html. This template supports only scale-out activities.
  zh-cn: Use a lifecycle hook to create an ENI and an EIP in batches and attach them to an instance. The ENI requires no configuration for instances that use CentOS 7.3 64-bit, CentOS 6.8 64-bit, or Windows Server 2008 R2 and later images. For other images, configure the ENI by referring to the official documentation at https://www.alibabacloud.com/help/document_detail/56955.html. This template supports only scale-out activities.
  ja: ライフサイクルセーフティフックを使用して Elastic Network Interface (ENI) と Elastic IP アドレス (EIP) を作成し、ECS インスタンスにアタッチします。CentOS 7.3 64 ビット、CentOS 6.8 64 ビット、または Windows Server 2008 R2 以降のイメージを使用するインスタンスの場合、ENI の設定は不要です。他のイメージの場合は、公式ドキュメント (https://www.alibabacloud.com/help/document_detail/56955.html) の指示に従って ENI を設定してください。このテンプレートは、スケールアウトアクティビティのみをサポートします。
  name-en: ACS-ESS-LifeCycleCreateNetworkInterfaceAndEipAndAttachToInstance
  name-zh-cn: Use a lifecycle hook to create an ENI and an EIP and attach them to an instance
  name-ja: ライフサイクルセーフティフックを使用して ENI と EIP を作成し、インスタンスにアタッチする
  categories:
    - elastic_manage
Parameters:
  internetChargeType:
    Label:
      en: InternetChargeType
      zh-cn: EIP billing method
      ja: EIP の課金方法
    Description:
      en: The billing method for the EIP. Valid values: PayByBandwidth and PayByTraffic.
      zh-cn: The billing method for the EIP. Valid values: PayByBandwidth (pay-by-bandwidth) and PayByTraffic (pay-by-data-transfer).
      ja: EIP の課金方法。有効値: PayByBandwidth と PayByTraffic。
    Type: String
    AllowedValues:
      - PayByBandwidth
      - PayByTraffic
    Default: PayByBandwidth
  bandwidth:
    Label:
      en: Bandwidth
      zh-cn: Peak bandwidth of the EIP
      ja: EIP のピーク帯域幅
    Description:
      en: The peak bandwidth of the EIP. Unit: Mbps.
      zh-cn: The peak bandwidth of the EIP. Unit: Mbps.
      ja: EIP のピーク帯域幅。単位: Mbps。
    Type: Number
    Default: 5
  regionId:
    Label:
      en: RegionId
      zh-cn: Region ID
      ja: リージョン ID
    Description:
      en: The ID of the region. Use the default value ${regionId} provided by Auto Scaling.
      zh-cn: The ID of the region. Use the default value ${regionId} provided by Auto Scaling.
      ja: リージョン ID。Auto Scaling が提供するデフォルト値 ${regionId} を使用します。
    Type: String
    Default: '${regionId}'
  instanceIds:
    Label:
      en: InstanceIds
      zh-cn: List of ECS instance IDs
      ja: ECS インスタンス ID のリスト
    Description:
      en: The list of ECS instance IDs. Use the default value ["${instanceIds}"] provided by Auto Scaling.
      zh-cn: The list of ECS instance IDs. Use the default value ["${instanceId}"] provided by Auto Scaling.
      ja: ECS インスタンス ID のリスト。Auto Scaling が提供するデフォルト値 ["${instanceIds}"] を使用します。
    Type: List
    Default:
      - '${instanceIds}'
  lifecycleHookId:
    Label:
      en: LifecycleHookId
      zh-cn: Lifecycle hook ID
      ja: ライフサイクルセーフティフックの ID
    Description:
      en: The ID of the lifecycle hook. Use the default value ${lifecycleHookId} provided by Auto Scaling.
      zh-cn: The ID of the lifecycle hook. Use the default value ${lifecycleHookId} provided by Auto Scaling.
      ja: ライフサイクルセーフティフックの ID。Auto Scaling が提供するデフォルト値 ${lifecycleHookId} を使用します。
    Type: String
    Default: '${lifecycleHookId}'
  lifecycleActionToken:
    Label:
      en: LifecycleActionToken
      zh-cn: Token for the scaling activity
      ja: スケーリングアクティビティのトークン
    Description:
      en: The token for the scaling activity. Use the default value ${lifecycleActionToken} provided by Auto Scaling.
      zh-cn: The token for the scaling activity. Use the default value ${lifecycleActionToken} provided by Auto Scaling.
      ja: インスタンスに関連付けられている特定のスケーリングアクティビティのトークン。Auto Scaling が提供するデフォルト値 ${lifecycleActionToken} を使用します。
    Type: String
    Default: '${lifecycleActionToken}'
  rateControl:
    Label:
      en: RateControl
      zh-cn: Rate control
      ja: レートコントロール
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 5
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: The RAM role to be assumed by OOS
      ja: OOS が引き受ける RAM ロール
    Type: String
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: createNetWorkInterfaceAndEipAndAttachToInstance
    Action: 'ACS::ECS::CreateNetworkInterfaceAndEipAndAttachToInstance'
    OnSuccess: CompleteLifecycleActionForContinue
    OnError: CompleteLifecycleActionForAbandon
    Description:
      en: Create an ENI and an EIP and attach them to the instance.
      zh-cn: Create an ENI and an EIP and attach them to the instance.
      ja: ENI と EIP を作成し、インスタンスにアタッチします。
    Properties:
      regionId: '{{ regionId }}'
      internetChargeType: '{{ internetChargeType }}'
      bandwidth: '{{ bandwidth }}'
      instanceId: '{{ ACS::TaskLoopItem }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ instanceIds }}'
  - Name: CompleteLifecycleActionForContinue
    Action: 'ACS::ExecuteAPI'
    Description:
      en: Set the lifecycle action to CONTINUE.
      zh-cn: Set the wait state of the scaling activity to Continue.
      ja: ライフサイクルアクションを 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: Set the lifecycle action to ABANDON.
      zh-cn: Set the wait state of the scaling activity to Abandon.
      ja: ライフサイクルアクションを ABANDON に設定します。
    Properties:
      Service: ESS
      API: CompleteLifecycleAction
      Parameters:
        RegionId: '{{ regionId }}'
        LifecycleHookId: '{{ lifecycleHookId }}'
        LifecycleActionToken: '{{ lifecycleActionToken }}'
        LifecycleActionResult: ABANDON