All Products
Search
Document Center

Elastic Compute Service:Release an instance

Last Updated:Sep 29, 2025

To avoid unnecessary charges for idle or unused Elastic Compute Service (ECS) instances, you can release them immediately or on a schedule through the console or an API. To prevent an instance from being accidentally released, you can enable release protection.

Impacts and risks

  • Data loss: When you release an instance, its local disks, system disk, and any data disks configured to be released with the instance are also released. It also deletes any automatic snapshots set for deletion with their associated cloud disks.

    Workaround: Back up your data. Manually create a snapshot or create a custom image in advance.

  • IP address loss: The static public IP address of the instance is reclaimed and cannot be recovered.

    Workaround: Convert the static public IP address to an Elastic IP Address (EIP).

  • Ongoing charges: Independent cloud resources, such as disks, EIPs, and snapshots that are not configured to be released with the instance, are not deleted and will continue to incur charges.

    Workaround: After releasing the instance, check your billing to identify and manually release any remaining billable resources.

Release a pay-as-you-go instance

Console

  1. Go to the ECS console - Instances page. Select the region and resource group of the target instance.

  2. In the Actions column for the target instance, click image > Instance Status > Release.

  3. In the Release Instance dialog box, select an option for Release Settings and click Next.

    • Release Now: The instance is released immediately.

    • Scheduled Release: The resource is automatically released at the specified time. For more information, see How to cancel a scheduled release.

  4. Carefully read the on-screen prompts, confirm which associated resources will be released and which will be retained, and then click OK. The instance is released based on the selected Release Settings.

API

Release a subscription instance

Important

You can release only expired subscription instances. To release a subscription instance that has not yet expired, you must first switch its billing method to pay-as-you-go.

Console

  1. Go to ECS console - Instances. Select the region and resource group of the target instance.

  2. In the Actions column for the target instance, click image > Instance Status > Release.

  3. In the Release dialog box, set Release Settings to Release Now and click Next.

  4. Carefully read the on-screen prompts, confirm which associated resources will be released and which will be retained, and then click OK.

API

When you release subscription instances that are expired, you must set the TerminateSubscription=true parameter.

Instance release protection

When release protection is enabled, the system rejects all manual release requests initiated from the console, an API, or the CLI. This prevents instances from being accidentally released due to human error or malicious actions.

This feature applies only to pay-as-you-go instances and only protects against manual release operations. It does not prevent automatic releases in the following scenarios:

  • The instance is reclaimed due to an overdue payment in your account.

  • A scheduled release task expires.

  • The instance is forcibly released for violating platform security rules, such as using an ECS instance to host an illegal website.

  • The Auto Scaling group to which the instance belongs triggers an automatic scale-in.

Enable release protection

Console

  1. Go to ECS console - Instances. Select the region and resource group of the target instance.

  2. In the Actions column for the target instance, click image > Instance Attributes > Enable Release Protection.

  3. In the dialog box that appears, click OK.

API

Call ModifyInstanceAttribute and set the DeletionProtection parameter to true.

Expected result: An attempt to release the instance returns the InvalidOperation.DeletionProtection error code.

Disable release protection

Console

  1. Go to ECS console - Instances. Select the region and resource group of the target instance.

  2. In the Actions column for the target instance, click image > Instance Attributes > Disable Release Protection.

  3. In the dialog box that appears, click OK.

API

Call ModifyInstanceAttribute and set the DeletionProtection parameter to false.

Check the release protection status

Console

  1. Go to ECS console - Instances. Select the region and resource group of the target instance.

  2. Click the instance ID to go to the instance details page. In the Other Information section, view the Release Protection status.

API

Call DescribeInstances and check the value of Instances.Instance.DeletionProtection. A value of true indicates that release protection is enabled.

Apply in production

In a production environment, follow these best practices to ensure your resources are secure:

  • Enforce release protection: Enable Release Protection for all production instances to prevent accidental deletion of core assets.

  • Use access control: Grant permissions to release instances (ecs:DeleteInstance and ecs:DeleteInstances) only to authorized personnel. To enhance security, separate the permission to modify instance attributes (ecs:ModifyInstanceAttribute), which includes disabling Release Protection, from the permission to delete instances and assign them to different roles.

  • Use ActionTrail: Enable ActionTrail to log all operations within your account. Configure alert rules for high-risk events, such as DeleteInstance and ModifyInstanceAttribute, to receive immediate notifications. This enables event tracking, auditing, and rapid response.

FAQ

  • Why is the "Release" button for my instance grayed out?

    The instance may be an unexpired subscription instance. You must first switch its billing method to pay-as-you-go before you can release it.

  • What is the difference between stopping and releasing an instance?

    These operations are fundamentally different.

    • Stop: This operation is like shutting down a computer. You can start the instance at any time to resume its operation.

    • Release: Releasing an instance permanently deletes it, along with its system disk, local disks, and any data disks configured for release. This data cannot be recovered. After an instance is released, it is removed from the instance list.

  • Can I recover an instance that was accidentally released?

    No. Releasing an instance is a permanent and irreversible action. The system retains no data or configuration from a released instance, making recovery impossible. Always back up data before you release an instance.

  • I released an instance, but why am I still being charged?

    Releasing an instance does not automatically release all of its associated resources. Check your billing to determine whether you are still being charged for associated resources that are billed independently, such as cloud disks, EIPs, or snapshots.

  • How can I release multiple instances at once?

  • How can I cancel a scheduled release?

    On the ECS console - Instances page, click the instance ID to go to its details page. In the Basic Information section, find Auto-release Time and click Cancel.

    image