- Newest
- Most votes
- Most comments
Generally, it is not possible to change the instance type of an EC2 instance without stopping it first. The standard procedure for changing an EC2 instance type requires stopping the instance, modifying its attributes, and then starting it again. This is true whether you're using the AWS Management Console, AWS CLI, or infrastructure-as-code tools like Terraform.
However, there are a few possibilities that might explain your experience:
-
Auto Scaling: If your EC2 instance was part of an Auto Scaling group, Terraform might have triggered a rolling update. This process could have launched a new instance with the desired type and terminated the old one, giving the appearance of a seamless change.
-
Scheduled Event: AWS occasionally requires instances to be stopped for maintenance. If such an event coincided with your Terraform change, it might have appeared that the instance type changed without manual intervention.
-
Misremembering: It's possible that the instance was briefly stopped and started as part of the Terraform apply process, but it happened so quickly that it wasn't noticed.
-
Terraform State Inconsistency: There might have been a discrepancy between Terraform's state and the actual AWS resources, leading to unexpected behavior.
In standard operations, changing an EC2 instance type always requires the instance to be in a stopped state. If you need to change instance types frequently without downtime, consider using Auto Scaling groups or implementing a blue-green deployment strategy to minimize disruption.
Sources
Change EC2 instance type | AWS re:Post
Feature Request: Change EC2 instance type more easily | AWS re:Post
Relevant content
- asked 5 months ago
- asked 2 years ago
- AWS OFFICIALUpdated 4 days ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago