S3 IAM role directly to the EC2 instance

Hello, I attached an IAM role directly to the EC2 instance. I understand that this approach is more secure than using an access key and manually configuring it for the S3 destination.

Is this possible?