This is an AWS error rather than a Terraform error, so you might get a more specific answer if you ask in an AWS forum, but I’ll do my best to guess what might be going on here. I’m also not familiar with the Udemy course you are following, so I’m not sure if there’s any additional context in that guide about how this is set up.
One guess is that the AMI you’ve selected here is using one or more EC2 features that are not available on a
t2.micro instance, in which case you’d need to select a more specialized instance type that has those features available.
Another guess is that
t2.micro instances are currently not available in your target availability zone. That doesn’t seem very likely to me given how common the
t2.micro instance type is, but I believe that is one reason why EC2 can return this error message.
Sadly it’s impossible to be sure what’s going on here because that error message is very generic and its details are part of the underlying AWS API implementation rather than something Terraform directly controls. I hope the above hints will help! If not, you might be able to get some AWS-specific help from the AWS developer forums or by contacting your course instructor to verify that this AMI ID is still valid.