Hello! I am currently trying to figure out the best way to manage IAM policies. I have an IAM role for EC2 that requires a lot of permissions. I’ve run into the 10 policy limit and was wondering how people usually go about adding more? The only way I could think of is consolidating the policies together to form one giant policy. Is this the best route?
I generally go by the rule that if you hit a limit quickly (policy statements, EIPs, security group ENI attachments, etc.) then you are probably not using it in the way it was intended.
With IAM policies you can have different services under the one block and it’ll know what resources apply to what services.
Alternatively, you quickly realize that most of those limits are completely arbitrary and mostly artificially placed, and Amazon has a drop-down ticket creation process that can increase them by another arbitrary #
You can use inline policies. Here are the full limits, and what you can request to have increased:
Q: How many policies can I attach to an IAM role?
For inline policies: You can add as many inline policies as you want to a user, role, or group, but the total aggregate policy size (the sum size of all inline policies) per entity cannot exceed the following limits:
User policy size cannot exceed 2,048 characters.
Role policy size cannot exceed 10,240 characters.
Group policy size cannot exceed 5,120 characters.
For managed policies: You can add up to 10 managed policies to a user, role, or group. The size of each managed policy cannot exceed 6,144 characters.
Q: How many IAM roles can I create?
You are limited to 1,000 IAM roles under your AWS account. If you need more roles, submit the IAM limit increase request form with your use case, and we will consider your request.
From a risk perspective, what would a compromised instance lead to in terms of access to sensitive data or high-impact API calls?
Have you thought of decoupling functionality to reduce the permissiveness of the IAM Role reducing the risk of this EC2 instance being a single point-of-failure?
Are you referring to splitting up responsibilities of the app e.g. a microservice architecture? I think that’s where we want to eventually end up being utilizing lambda for serverless. We’re using elastic beanstalk for app deployments for it’s ease of use (most of them time… ) So the ec2 server requires permissions specific to the application and permissions specific to elastic beanstalk multi docker deployments e.g. s3, ecs, ecr…
I do agree that splitting up app functionality and therefore splitting up IAM roles would be ideal. Our app wasn’t designed to be horizontally scalable up until now which is why we moved it over to an autoscaling architecture. Still learning about all of the amazing functionalities of AWS… Baby steps