5
votes

Recently got an email titled, "Important News from AWS About Amazon EC2-Classic" describing some changes that need to occur. These emails from AWS usually reference the effected resources though and this one did not. I am having a hard time identifying what resources in our account are effected by this. All our EC2 instances are in a VPC and I am not even sure if anything needs to change or not.

Is there a way to identify that an EC2 instance is classic?

I have looked through their linked documentation and gone through the instances we have but I cannot tell if they are "classic" of not.

2

2 Answers

7
votes

You can identify the EC2-Classic env by checking the instance has VPC ID or not.

EC2 console

VPC ID is not shown by default. Enable VPC ID from Preference -> Attribute columns.

Then if VPC ID attribute is -, that means the instance is EC2-Classic.

CLI

2 ways for checking. Output is none unless EC2-classic instances exist.

  • Describe instance with EC2-Classic env.
aws ec2 describe-instances | jq '.Reservations[].Instances[] | select(.VpcId == null)'
  • Describe the instance if it is the EC2-Classic.
aws ec2 describe-instances --instance-id i-xxxxxxxxxxxx | jq '.Reservations[].Instances[] | select(.VpcId == null)'
1
votes

Not enough reputation to comment. The answer from shimo should be modified to filter out terminated instances. It's an edge case but may lead folks with high turnover in accounts down a rabbit hole because EC2 instances that have been terminated are no longer associated with a VPC ID.

aws ec2 describe-instances --filters Name=instance-state-name,Values=pending,running,shutting-down,stopping,stopped | jq '.Reservations[].Instances[] | select(.VpcId == null)'