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

Description

  • If you enable auto-renewal for your subscription dedicated host, the dedicated host is automatically renewed nine days before expiration. The renewal fees are automatically paid at 08:00:00 (UTC+8). If the fees are not paid, they are paid at the same point in time the next day. Automatic payment stops after the fees are paid or after the dedicated host expires and is locked. Make sure that you have sufficient balance within your account.
  • Subscription dedicated hosts can be automatically renewed along with the subscription Elastic Compute Service (ECS) instances hosted on the dedicated hosts. For more information, see the description of the AutoRenewWithEcs parameter.

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 the dedicated hosts. You can specify up to 100 subscription dedicated host IDs. Separate multiple IDs with commas (,).

RegionId String Yes cn-hangzhou

The region ID of the dedicated host.

Duration Integer No 1

The renewal duration of the dedicated host. Valid values:

  • When the PeriodUnit parameter is set to Week, the valid values of the Duration parameter are 1, 2, and 3.
  • When the PeriodUnit parameter is set to Month, the valid values of the Duration parameter are 1, 2, 3, 6, and 12.
PeriodUnit String No Month

The unit of the renewal duration. Valid values:

  • Week
  • Month

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, but 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 dedicated host determines the expiration time of the renewed instances, and selects a minimum value from the valid values of the Duration parameter 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 dedicated host selects a renewal duration of 12 months, which is the minimum value of the Duration parameter (PeriodUnit=Month) that allows the dedicated host to expire 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-70D339F64DE7

The ID of the request.

Samples

Sample requests

https://ecs.aliyuncs.com/?Action=ModifyDedicatedHostAutoRenewAttribute
&DedicatedHostIds=dh-bp165p6xk2tlw61e****
&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-70D339F64DE7</RequestId>
</ModifyDedicatedHostAutoRenewAttributeResponse>

JSON format

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

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

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 dedicated host 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.