How to find if AWS instance is running Amazon Linux 1 or 2?

You can get the Amazon Linux OS version from /etc/os-release.