aws_ iam_ role_ policy cost estimation
An inline IAM policy embedded directly in a role. IAM is completely free, there is no charge for roles, policies, or evaluation. The cost lives in the AWS services the policy grants access to.
The aws_
IAM is a free service. AWS does not charge for roles, users, groups, inline policies, managed policies, policy evaluation, or the number of API authorization decisions made. You can create thousands of role policies and pay nothing for IAM itself. This is deliberate, IAM is the control plane that gates access to every paid AWS service, so AWS keeps it free to encourage least-privilege design.
The real cost is downstream. An IAM role policy is the key that unlocks spend. A policy that grants ec2:RunInstances lets a workload launch instances that bill by the hour. A policy that grants s3:PutObject enables storage and request charges. An overly broad policy (for example Action "*" on Resource "*") does not cost more in IAM terms, but it dramatically widens the blast radius: a compromised credential or a runaway automation can spin up expensive resources across every service. Cost governance and security governance are the same problem here.
There are also indirect costs to be aware of. If you log and analyze IAM activity through CloudTrail data events, AWS Config rules that evaluate IAM policies, or Access Analyzer findings routed to Security Hub, those downstream analysis services bill even though the policy itself does not. IAM Access Analyzer external access analysis is free, but unused access analysis is a paid feature billed per IAM role and user analyzed.
c3x treats aws_
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "aws_iam_role" "app" {
name = "app-runtime-role"
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Action = "sts:AssumeRole"
Effect = "Allow"
Principal = { Service = "ec2.amazonaws.com" }
}]
})
}
resource "aws_iam_role_policy" "app_s3_read" {
name = "app-s3-read"
role = aws_iam_role.app.id
policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Action = ["s3:GetObject", "s3:ListBucket"]
Resource = [
"arn:aws:s3:::my-app-data",
"arn:aws:s3:::my-app-data/*",
]
}]
})
}Pricing dimensions
What you actually pay for when you provision aws_.
| Dimension | Unit | What's being charged |
|---|---|---|
| IAM inline role policy | free | Roles, inline policies, and all IAM authorization decisions are free. There is no per-policy or per-evaluation charge. $0 (free) |
| IAM Access Analyzer (unused access) | per analyzed principal | Optional unused access analysis that flags stale roles and users. External access analysis remains free. $0.20 per IAM role or user analyzed per month |
| AWS Config rule evaluation | per evaluation | If you evaluate IAM policies with Config rules, each configuration item evaluation bills. $0.001 per rule evaluation |
Optimization tips
Common ways to reduce aws_ cost without changing the workload.
Scope policies to specific actions and resources
The IAM policy costs nothing, but a wildcard grant lets any holder of the credential launch expensive resources. Scoping ec2, rds, and sagemaker actions to named resources and adding conditions caps the potential runaway spend a compromised role can cause.
Prefer managed policies for reuse, inline for uniqueness
Inline policies are deleted with the role and cannot be reused, which is good for one off grants but leads to drift when the same permissions are copied across many roles. Use aws_
Add cost-control conditions to launch permissions
For roles that can create instances, use condition keys like ec2:InstanceType or aws:RequestedRegion to block oversized or off-region resources. This turns the free policy into a guardrail against accidental large bills.
Retire unused roles flagged by Access Analyzer
Unused roles are not billed by IAM, but they are a security and audit liability. Access Analyzer unused access analysis surfaces stale roles so you can delete them and shrink the attack surface.
FAQ
Does an IAM role policy cost anything?
No. IAM is free. There is no charge for roles, inline policies, managed policies, or the authorization decisions IAM makes on every API call. AWS monetizes the services the policies grant access to, not IAM itself.
What is the difference between aws_ iam_ role_ policy and aws_ iam_ policy?
aws_
If IAM is free, why does it show up in cost discussions?
Because IAM policies are where spend authorization begins. A policy that grants broad create permissions is the mechanism by which a compromised credential or buggy automation can generate large bills. Cost governance teams review IAM to understand what a workload is allowed to provision.
Are there any IAM features that do cost money?
IAM Access Analyzer unused access analysis is billed per IAM role and user analyzed per month. External access analysis is free. IAM itself, including roles and policies, is always free.
Related resources
More AWS resources
Estimate this resource in your own Terraform
Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including aws_.