AWS IAM EC2 Instance Role using Terraform
IAM Roles are used to granting the application access
to AWS Services without using permanent credentials.
IAM Role is one of the safer ways to give permission to
your EC2 instances.
to AWS Services without using permanent credentials.
IAM Role is one of the safer ways to give permission to
your EC2 instances.
We can attach roles to an EC2 instance, and that allows us to give
permission to EC2 instance to use other AWS Services, for example,
S3 buckets, database dynamo DB, ASG
permission to EC2 instance to use other AWS Services, for example,
S3 buckets, database dynamo DB, ASG
Create an Assume role as below, assume_role_policy
— (Required) The policy that grants an entity permission
to assume the role.
— (Required) The policy that grants an entity permission
to assume the role.
This is going to create IAM role but we can’t link this role to
EC2 Instance and for that, we need EC2 instance Profile
Create EC2 Instance Profile using below code
Now if we execute the above code, we have Role and Instance
Profile but with no permission.so lets add IAM Policies which
allows EC2 instance to execute specific commands for example:
access to S3 Bucket
Adding IAM Policies,for giving full access to S3 bucket
Attach this role to EC2 instance
It’s time to execute code run
Great Article. I found so many interesting stuff in your blog especially its discussionvisit site
ReplyDeleteThis post is so usefull and informative.Keep updating with more information...
ReplyDeleteAWS Training In Mumbai
AWS Training In Ahmedabad
AWS Training In Kochi
AWS Training In Trivandrum
AWS Training In Kolkata