Modifie le mode de facturation des instances ECS lors d'une activité de mise à l'échelle horizontale (scale-out) en utilisant un hook de cycle de vie.
Nom du modèle
ACS-ESS-LifeCycleModifyInstanceChargeType : Modifie le mode de facturation d'une instance à l'aide d'un hook de cycle de vie (uniquement pour les activités de mise à l'échelle horizontale)
Description du modèle
Utilise un hook de cycle de vie pour modifier le mode de facturation d'une instance. Seules les activités de mise à l'échelle horizontale sont prises en charge.
Type de modèle
Automatisé
Propriétaire
Alibaba Cloud
Paramètres d'entrée
|
Paramètre |
Description |
Type de données |
Obligatoire |
Valeur par défaut |
Limite |
|
instanceChargeType |
Nouveau mode de facturation des instances. |
String |
Non |
PostPaid |
|
|
periodUnit |
Unité de durée de renouvellement des instances. |
String |
Non |
Month |
|
|
period |
Durée de renouvellement. |
Number |
Non |
1 |
|
|
includeDataDisks |
Indique s'il faut modifier le mode de facturation des disques de données attachés aux instances. |
Boolean |
Non |
False |
|
|
autoRenew |
Indique s'il faut renouveler automatiquement l'instance avant son expiration. |
Boolean |
Non |
False |
|
|
networkChargeType |
Nouveau mode de facturation pour le réseau. |
String |
Non |
PayByTraffic |
|
|
lifecycleActionResult |
Action à entreprendre après la fin de l'état d'attente du hook de cycle de vie. |
String |
Non |
${lifecycleActionResult} |
|
|
regionId |
ID de la région. |
String |
Non |
${regionId} |
|
|
instanceIds |
Liste des ID d'instances ECS. |
List |
Non |
${instanceIds} |
|
|
OOSAssumeRole |
Rôle RAM à endosser par OOS. |
String |
Non |
"" |
|
|
rateControl |
Taux de concurrence pour l'exécution des tâches. |
Json |
Non |
{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} |
|
|
lifecycleActionToken |
Jeton pour l'activité de mise à l'échelle associée à l'instance. |
String |
Non |
${lifecycleActionToken} |
|
|
OOSAssumeRole |
Rôle RAM endossé par OOS. |
String |
Non |
"" |
Paramètres de sortie
Sans objet.
Politique d'autorisation requise pour exécuter le modèle
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:ModifyInstanceAutoRenewAttribute",
"ecs:ModifyInstanceChargeType",
"ecs:ModifyInstanceNetworkSpec"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ess:CompleteLifecycleAction"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Détails
ACS-ESS-LifeCycleModifyInstanceChargeType
Contenu du modèle
FormatVersion: OOS-2019-06-01
Description:
en: Uses a lifecycle hook to change the instance billing method during a scale-out activity.
zh-cn: Uses a lifecycle hook to change the instance billing method (for scale-out activities only).
name-en: ACS-ESS-LifeCycleModifyInstanceChargeType
name-zh-cn: UseLifecycleHookToChangeInstanceBillingMethodForScaleOut
categories:
- elastic_manage
Parameters:
instanceChargeType:
Label:
en: InstanceChargeType
zh-cn: Target billing method for the instance
Type: String
AllowedValues:
- PostPaid
- PrePaid
Default: PostPaid
periodUnit:
Label:
en: PeriodUnit
zh-cn: Time unit for the renewal period
Type: String
AllowedValues:
- Week
- Month
Default: Month
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${instanceChargeType}
- PostPaid
period:
Description:
en: The subscription period of the instance.
zh-cn: If PeriodUnit is Week, the valid values for Period are 1 to 4. If PeriodUnit is Month, the valid values for Period are 1 to 12, 24, 36, 48, and 60.
Label:
en: Period
zh-cn: Renewal period
Type: Number
Default: 1
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${instanceChargeType}
- PostPaid
includeDataDisks:
Description:
en: Specifies whether to change the billing method of all data disks attached to the instance from pay-as-you-go to subscription.
zh-cn: Specifies whether to convert all attached pay-as-you-go data disks to subscription data disks.
Label:
en: IncludeDataDisks
zh-cn: Convert data disks
Type: Boolean
Default: false
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${instanceChargeType}
- PostPaid
autoRenew:
Description:
en: Specifies whether to automatically renew the instance before it expires.
zh-cn: Specifies whether to automatically renew the instance before it expires.
Label:
en: AutoRenew
zh-cn: Enable auto-renewal before expiration
Type: Boolean
Default: false
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${instanceChargeType}
- PostPaid
networkChargeType:
Label:
en: NetworkChargeType
zh-cn: Target billing method for the network
Type: String
AllowedValues:
- PayByBandwidth
- PayByTraffic
Default: PayByTraffic
lifecycleActionResult:
Label:
en: LifecycleActionResult
zh-cn: Next action after the lifecycle hook wait state ends
Description:
en: The next action for the lifecycle hook after its wait state ends, if the command fails.
zh-cn: The next action for the lifecycle hook after its wait state ends, if the command fails.
Type: String
AllowedValues:
- ABANDON
- ROLLBACK
- CONTINUE
Default: ABANDON
regionId:
Label:
en: RegionId
zh-cn: Region ID
Description:
en: The ID of the region.
zh-cn: The region ID. Use the default value ${regionId} from Auto Scaling.
Type: String
Default: ${regionId}
instanceIds:
Label:
en: InstanceIds
zh-cn: List of ECS instance IDs
Description:
en: The list of ECS instance IDs.
zh-cn: The list of ECS instance IDs. Use the default value ["${instanceId}"] from Auto Scaling.
Type: List
Default:
- ${instanceIds}
lifecycleHookId:
Label:
en: LifecycleHookId
zh-cn: Lifecycle hook ID
Description:
en: The ID of the lifecycle hook.
zh-cn: The ID of the lifecycle hook. Use the default value ${lifecycleHookId} from Auto Scaling.
Type: String
Default: ${lifecycleHookId}
rateControl:
Label:
en: RateControl
zh-cn: Concurrency rate for task execution
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
lifecycleActionToken:
Label:
en: LifecycleActionToken
zh-cn: Token for the scaling activity associated with the instance
Description:
en: The token that indicates a specific scaling activity associated with an instance.
zh-cn: The token for the specific scaling activity associated with the instance. Use the default value ${lifecycleActionToken} from Auto Scaling.
Type: String
Default: ${lifecycleActionToken}
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: RAM role assumed by OOS
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: sleepTask
Action: ACS::Sleep
Properties:
Duration: 10s
- Name: modifyInstanceChargeType
OnError: CompleteLifecycleActionForAbandon
Description:
en: Modifies the instance billing method.
zh-cn: Change instance billing method
Action: ACS::ECS::ModifyInstanceChargeType
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
instanceChargeType: '{{ instanceChargeType }}'
networkChargeType: '{{ networkChargeType }}'
period: '{{ period }}'
periodUnit: '{{ periodUnit }}'
includeDataDisks: '{{ includeDataDisks }}'
Loop:
Items: '{{ instanceIds }}'
RateControl: '{{ rateControl }}'
- Name: modifyInstanceAutoRenewAttribute
OnError: CompleteLifecycleActionForAbandon
OnSuccess: CompleteLifecycleActionForContinue
Description:
en: Modifies the auto-renewal settings of the instance.
zh-cn: Set auto-renewal status for subscription instances
Action: ACS::ECS::ModifyInstanceAutoRenewAttribute
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
autoRenew: '{{ autoRenew }}'
duration: '{{ period }}'
periodUnit: '{{ periodUnit }}'
Loop:
Items: '{{ instanceIds }}'
RateControl: '{{ rateControl }}'
When:
Fn::Equals:
- '{{ autoRenew }}'
- true
- Name: CompleteLifecycleActionForContinue
Action: ACS::ExecuteAPI
Description:
en: Sets the lifecycle action to CONTINUE.
zh-cn: Change the wait state of the scaling activity 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.
zh-cn: Change the wait state of the scaling activity to ABANDON
Properties:
Service: ESS
API: CompleteLifecycleAction
Parameters:
RegionId: '{{ regionId }}'
LifecycleHookId: '{{ lifecycleHookId }}'
LifecycleActionToken: '{{ lifecycleActionToken }}'
LifecycleActionResult: '{{ lifecycleActionResult }}'