Enables or disables auto-renewal for one or more subscription dedicated hosts.

Description

  • If you enable auto-renewal for your subscription dedicated host, the system attempts to deduct the renewal payment at 08:00:00 (UTC+8) nine days before the dedicated host expires to renew the dedicated host. If this deduction attempt fails, the system attempt to deduct the payment at the same point in time the next day. The system attempts to deduct the payment once every day until the dedicated host expires or until the payment is deducted. Make sure that your account balance is sufficient.
  • Subscription dedicated hosts can be automatically renewed along with the subscription Elastic Compute Service (ECS) instances that are hosted on the dedicated hosts. For more information, see the description of the AutoRenewWithEcs parameter.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifyDedicatedHostAutoRenewAttribute

The operation that you want to perform. Set the value to ModifyDedicatedHostAutoRenewAttribute.

DedicatedHostIds String Yes dh-bp165p6xk2tlw61e****

The IDs of dedicated hosts. You can specify up to 100 subscription dedicated host IDs. Separate the IDs with commas (,).

RegionId String Yes cn-hangzhou

The region ID of the dedicated host.

Duration Integer No 1

The renewal duration. Valid values:

  • Valid values when PeriodUnit is set to Month: 1 and 12
  • Valid values when PeriodUnit is set to Year: 1 and 12
PeriodUnit String No Month

The unit of the renewal duration. Valid values:

  • Month
  • Year

Default value: Month.

AutoRenew Boolean No false

Specifies whether to automatically renew the subscription dedicated host. Valid values:

  • true: automatically renews the subscription dedicated host.
  • false: does not automatically renew the subscription dedicated host.

Default value: false.

RenewalStatus String No Normal

Specifies whether to automatically renew the subscription dedicated host. The RenewalStatus parameter takes precedence over the AutoRenew parameter. Valid values:

  • AutoRenewal: automatically renews the subscription dedicated host.
  • Normal: does not automatically renew the subscription dedicated host, and notifications for renewal are sent.
  • NotRenewal: does not automatically renew the subscription dedicated host, and no expiration notification is sent. Notifications for renewal are automatically sent three days before the expiration time of the subscription dedicated host. You can change the value of this parameter from NotRenewal to Normal for the dedicated host and manually renew it by calling the RenewDedicatedHosts operation. Alternatively, you can renew it by setting this parameter to AutoRenewal.
AutoRenewWithEcs String No StopRenewWithEcs

Specifies whether to automatically renew the subscription dedicated host along with the subscription ECS instances hosted on it.

If auto-renewal is enabled for the subscription ECS instances hosted on your subscription dedicated host, you can specify this parameter to automatically renew the dedicated host along with the subscription ECS instances. When the subscription ECS instances hosted on your dedicated host are automatically renewed, the dedicated host is also automatically renewed if the expiration time of the dedicated host is earlier than the expiration time of the renewed instances.

When the dedicated host is configured to be automatically renewed along with the subscription ECS instances hosted on it, the system checks the expiration time of the renewed instances and selects a minimum renewal duration for the dedicated host so that the dedicated host is renewed by a duration that expires later than the expiration time of the renewed instances. For more information about supported renewal durations, see the descriptions of the PeriodUnit and Duration parameters.

For example, assume that you have a subscription dedicated host that expires on January 15 of the current year. Subscription ECS instances hosted on the dedicated host have the auto-renewal feature enabled, and are automatically renewed to November 15 of the same year. The expiration time of the dedicated host is earlier than the expiration time of the ECS instances by 10 months. In this case, the system selects a renewal duration of 12 months (a minimum duration calculated based on a Duration value of 12 and a PeriodUnit value of Month) for the dedicated host so that the dedicated host expires later than the ECS instances.

Valid values:

  • AutoRenewWithEcs: automatically renews the subscription dedicated host along with the subscription ECS instances hosted on it.
  • StopRenewWithEcs: does not automatically renew the subscription dedicated host along with the subscription ECS instances hosted on it.
  • NoOperation: does not change the current settings for the dedicated host.
Note If you set this parameter to AutoRenewWithEcs, make sure that AutoRenew is set to true to enable auto-renewal for the dedicated host. Otherwise, only the parameter value is changed. The dedicated host is not automatically renewed along with the subscription ECS instances hosted on it.

Default value: NoOperation.

Response parameters

Parameter Type Example Description
RequestId String 2A4EA075-CB5B-41B7-B0EB-70D339F6****

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=ModifyDedicatedHostAutoRenewAttribute
&DedicatedHostIds=dh-bp165p6xk2tlw61e****
&Duration=1
&PeriodUnit=Month
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyDedicatedHostAutoRenewAttributeResponse>
    <RequestId>2A4EA075-CB5B-41B7-B0EB-70D339F6****</RequestId>
</ModifyDedicatedHostAutoRenewAttributeResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "2A4EA075-CB5B-41B7-B0EB-70D339F6****"
}

Error codes

HTTP status code Error code Error message Description
403 MissingParameter.DedicatedHostId DedicatedHostId should not be null. The error message returned because the DedicatedHostIds parameter is not specified.
403 InvalidParameter.ToManyDedicatedHostIds DedicatedHostId should be less than 100. The error message returned because more than 100 dedicated host IDs are specified in the DedicatedHostIds parameter.
403 InvalidParameter.InvalidDedicatedHostId %s The error message returned because the specified DedicatedHostIds parameter is invalid.
403 IncorrectHostStatus The current status of the resource does not support this operation. The error message returned because the operation is not supported while the resource is in the current state.
403 ChargeTypeViolation Pay-As-You-Go dedicated host do not support this operation. The error message returned because pay-as-you-go dedicated hosts do not support this operation.
403 InvalidParameter.Duration %s The error message returned because the specified Duration parameter is invalid.
403 InvalidParameter.RenewalStatus %s The error message returned because the specified RenewalStatus parameter is invalid.
403 InvalidPeriodUnit.ValueNotSupported The specified parameter PeriodUnit is not valid. The error message returned because the specified PeriodUnit parameter is invalid.

For a list of error codes, visit the API Error Center.