Creating an EC2 Instance with an IAM Role is easy when you do it via the AWS Console but doing this with CloudFormation is not as direct. You will need an Instance Profile
to connect an EC2 with an IAM Role.
TL;DR: See the CloudFormation Template below.
Continue reading EC2 with IAM Role: CloudFormation Sample Template