- Navigate to IAM Dashboard
- Click on Roles on the left menu
- Click on Create role
- Select AWS service as the type of trusted entity
- Select EC2 as the use case
- Click on Next: Permissions
- In the Search bar, type in the name of the service you want EC2 to access, for instance S3 or DynamoDB
- Check the policies that match your needs, always follow the principal of least privilege
- Click on Next: Tags
- Provide Key and Value pairs if using Tagging, otherwise click on Next: Review
- Provide a Role name
- Click on Create role
Now you can attach this role to an EC2 instance and this instance will have access to other AWS services according to the policies you selected.
Here are the steps to attach an IAM role to an EC2 instance –
- Navigate to the EC2 dashboard
- Click on Instances on the left menu
- Select the EC2 instance you want to provide access to
- Click on Actions, then Security, then Modify IAM role
- Pick the role from the drop down and click on Save
Now this EC2 instance should have the appropriate access to other AWS services.