You can run this command below on an EC2 Linux instance to check if the current instance is in an AutoScaling group. You will need to check if the returned value is empty to determine if it is in an AutoScaling group or not.
aws autoscaling describe-auto-scaling-instances --instance-ids `curl --silent http://169.254.169.254/latest/meta-data/instance-id 2>&1`
Note, you will have to have the AWS CLI Tool installed and configured before you can run this command.
Take reference from: https://docs.aws.amazon.com/cli/latest/reference/autoscaling/describe-auto-scaling-instances.html
CLI Docs: https://aws.amazon.com/cli/