AWS IAM Role allows an entity to assume a role and get the permissions to access the AWS resources. The entity can be a federated user, a cross-account user, or an AWS resource. Consider we have an Amazon EC2 instance as an Entity and want to access Amazon S3. So to get access, we need to attach the IAM Role (having permissions to access S3) to our EC2 instance. So now, the EC2 instance can assume the role and get the permissions to access S3.
Let's look at different ways to create the AWS IAM Role.