amazon-web-servicesamazon-ec2

EBS volumes are not getting terminated when their corresponding ec2 instance is terminated


I'm using Elastic Beanstalk with EC2 t2.2xlarge instances and have set my deployment policy to "rolling with additional batches." This means that when I deploy, a fresh batch of instances is spun up, and the older ones are terminated. Lately, I've observed that when the old instances are terminated, the EBS volumes connected to them remain available instead of being terminated as well. In my auto-scaling launch template, the "delete on terminate" option is set to true. However, in the volume settings, it indicates "delete on terminate" is false.

I am paying extra for the unused volumes(which ideally should have been terminated with ec2 instances), can someone help me figure out how to resolve this, Is this some configuration issue or some kind of a bug with aws?


Solution

  • I was able to figure this out, I had created EC2 instances from a custom AMI which had some other configurations and packages pre-installed, In that custom AMI delete on terminate was set to false.