Altera o método de faturamento de instâncias ECS durante uma atividade de expansão usando um lifecycle hook.
Nome do modelo
ACS-ESS-LifeCycleModifyInstanceChargeType: altera o método de faturamento de uma instância usando um lifecycle hook (apenas para atividades de expansão)
Descrição do modelo
Usa um lifecycle hook para alterar o método de faturamento de uma instância. Compatível apenas com atividades de expansão.
Tipo de modelo
Automatizado
Proprietário
Alibaba Cloud
Parâmetros de entrada
|
Parâmetro |
Descrição |
Tipo de dados |
Obrigatório |
Valor padrão |
Limite |
|
instanceChargeType |
Novo método de faturamento das instâncias. |
String |
Não |
PostPaid |
|
|
periodUnit |
Unidade de tempo da duração da renovação das instâncias. |
String |
Não |
Month |
|
|
period |
Duração da renovação. |
Number |
Não |
1 |
|
|
includeDataDisks |
Indica se o método de faturamento dos discos de dados anexados às instâncias deve ser alterado. |
Boolean |
Não |
False |
|
|
autoRenew |
Define se a instância será renovada automaticamente antes do vencimento. |
Boolean |
Não |
False |
|
|
networkChargeType |
Novo método de faturamento para a rede. |
String |
Não |
PayByTraffic |
|
|
lifecycleActionResult |
Ação a executar após o término do estado de espera do lifecycle hook. |
String |
Não |
${lifecycleActionResult} |
|
|
regionId |
ID da região. |
String |
Não |
${regionId} |
|
|
instanceIds |
Lista de IDs de instâncias ECS. |
List |
Não |
${instanceIds} |
|
|
OOSAssumeRole |
Função RAM que o OOS assume. |
String |
Não |
"" |
|
|
rateControl |
Taxa de concorrência para execução da tarefa. |
Json |
Não |
{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} |
|
|
lifecycleActionToken |
Token da atividade de dimensionamento associada à instância. |
String |
Não |
${lifecycleActionToken} |
|
|
OOSAssumeRole |
Função RAM assumida pelo OOS. |
String |
Não |
"" |
Parâmetros de saída
N/D.
Política de permissões necessária para executar o modelo
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:ModifyInstanceAutoRenewAttribute",
"ecs:ModifyInstanceChargeType",
"ecs:ModifyInstanceNetworkSpec"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ess:CompleteLifecycleAction"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Detalhes
ACS-ESS-LifeCycleModifyInstanceChargeType
Conteúdo do modelo
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 }}'