Creating IAM roles
Think of an IAM role as being similar to an IAM user. It's an AWS identity that defines a group of permissions for making AWS service requests. The IAM role is assumed by the following:
- Applications
- External users
Advantages of using an IAM role
The advantages of using an IAM role are as follows:
- It provides temporary security credentials for your role session.
- We no longer need to embed permanent credentials inside applications.
- You can grant users in one AWS account access to resources in another account.
- It easily federates external users.
Creating an IAM role using Terraform
Let's try to understand an IAM role with the help of an example. We can attach an IAM role to an EC2 instance in order to use other AWS services, such as an S3 bucket. To demonstrate this example, I will be using Terraform.
Create a file called iam_
role.tf and copy the code provided at https://github.com/PacktPublishing/AWS...