How could I retrive the OS type from aws instances and make a report

I have set up chef opswork on AWS and would like to use it to retrieve instance type (RHEL, Amazon Linux, Windows) to make a report. I got an assignment to replace all the RHEL instances with Amazon Linux), I have already added the instances into chef opsworks but don’t know which command I need to use.