EC2 instance type change without stopping?

0

Hi, Is it possible to change instance type without stopping the EC2? From the console at-least, this definitely is not allowed. But I remember few days ago, via Terraform it happened somehow (we had made the change to downgrade from t4g.medium to t4g.small and someone accidentally merged the PR before stopping and manually doing the downgrade. But Terraform somehow downgraded without us manually doing anything -- our expectation was it would replace the instance but this did not happen and it downgraded in-place)..

Just wondering if I am remembering it wrong or there are some circumstances under which upgrade/downgrade can happen on a running instance.

asked a month ago68 views
1 Answer
0

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:

  1. 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.

  2. 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.

  3. 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.

  4. 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

profile picture
answered a month ago
profile pictureAWS
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions