AWS Policies explained?

Viewed 47

I am learning AWS and I have the following task in an online training course:

Configure the MongoDB VM as highly privileged – configure an instance profile to the VM and add the permission “ec2:*” as a custom policy.

I am trying to work out what that means. Is the task asking for a role that enables the VM instance to have full control over all EC2 resources?

If I understand it correctly, then I think the following policy would implement it.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "ec2:*"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:ec2:*:*:instance"
        }
    ]
}

My understanding is that this policy is saying any EC2 instance can perform any EC2 action. Is that right?

1 Answers

I would say you are almost correct. Roles are attached to individual services which means your particular VM can perform any Ec2 action on this resource arn:aws:ec2:*:*:instance.

There is a difference in saying any ec2 can perform ec2 action instead that ec2 instance can perform any ec2 action to which this role is attached.

Related