What is an IAM role?

An IAM role is a temporary permission identity that can be assumed by users, services, or applications. It does not have permanent login credentials and provides temporary access to AWS resources.

Architecture

image.png

This architecture is for understanding purpose. Every step is the same from this blog according to the architecture and the only thing we are not adding is this part: “Adding Objects via CLI”

How to Attach an IAM Role to an EC2 Instance

Step 1:-Go to the AWS console and search for IAM service

image.png

Click on IAM.

Step 2:-Now click on “Roles” on the left side menu bar

image.png

Step 3:-Click on Create role

image.png

Step 4:-In the “Create role” click on the AWS service as the trusted entity type.