In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
How to keep the root volume when terminating an AWS instance. I believe many inexperienced people are helpless about this. For this reason, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
When the AWS console creates EC2, we select the Delete on Termination configuration by default in the Add Storage step if the default configuration is used. That is to say, when the instance is terminated, the mounted EBS volume will be deleted at the same time. The impact of this is that the software packages or stored data configured in this volume will be deleted directly.
Unfortunately, the aws web admin console doesn't have an option to override this default, so do we have a solution that meets this requirement? The answer is yes, but it can only be done through aws 'cli command-line tool.
In the ec2 service of aws, this associated attribute is DeleteOnTermination. When a user terminates an ec2 instance, the system checks the value of this attribute to determine whether to keep or delete the volume. The default value for the DeleteOnTermination attribute varies depending on whether the volume is the root volume of the instance, so let's go straight to how to handle this.
First we start an ec2 instance, which we mentioned above, with the "delete on termination" configuration option using the default configuration when adding storage. At this time, we use the cli tool to check the DeleteOnTermination attribute value, as shown in the following figure:
Then at this point we try to terminate the instance and look at the system prompt:
In the above figure, when the instance is terminated, the prompt given by the system clearly gives the corresponding information in the warning.
Then let's set the DeleteOnTermination attribute value to false, use the command modify-instance-attribute, the complete command is: aws ec2 modify-instance-attribute --instance-id --block-device-mappings "[{"DeviceName": ","Ebs":{"DeleteOnTermination":false}}]", and modify the and parts according to the actual situation. Then we execute the command and see the changes:
We see that the attributes corresponding to the instance have been modified, and then we look at the system prompt when terminating the instance:
At this point we have seen the system prompt changes, this time we try to directly terminate the instance, the status of the EBS volume.
The example above has been terminated normally.
In the image above, we can see that the status of this EBS volume is still normal and can still be used.
After reading the above, do you know how to preserve the root volume when terminating an AWS instance? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.