aws_ iam_ access_ key cost estimation
A long-lived access key ID and secret for an IAM user. Access keys are free to create and use, but a leaked key is one of the most expensive incidents in AWS, capable of running up tens of thousands of dollars in hours.
The aws_
The reason this resource matters for cost is risk, not price. A leaked access key is one of the classic ways to generate a catastrophic AWS bill. Because the key carries the full permissions of its IAM user, an attacker who finds one committed to a public repository, embedded in a mobile app, or leaked in logs can launch large GPU instances for crypto mining, spin up thousands of resources, or exfiltrate data across regions and rack up data transfer charges. Real incidents have produced bills from thousands to hundreds of thousands of dollars before AWS abuse detection or the account owner noticed.
The safer pattern is to avoid long-lived access keys almost entirely. For workloads running on AWS compute, use IAM roles (aws_
When you must use them, put the secret in a secure store rather than plain Terraform state. Note that aws_
c3x reports aws_
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "aws_iam_user" "ci" {
name = "ci-deploy"
}
resource "aws_iam_access_key" "ci" {
user = aws_iam_user.ci.name
}
# Store the secret rather than printing it. State still holds it in cleartext,
# so keep the state backend encrypted and access-controlled.
resource "aws_secretsmanager_secret" "ci_key" {
name = "ci-deploy-access-key"
}
resource "aws_secretsmanager_secret_version" "ci_key" {
secret_id = aws_secretsmanager_secret.ci_key.id
secret_string = jsonencode({
access_key_id = aws_iam_access_key.ci.id
secret_access_key = aws_iam_access_key.ci.secret
})
}Pricing dimensions
What you actually pay for when you provision aws_.
| Dimension | Unit | What's being charged |
|---|---|---|
| IAM access key | free | Creating and using access keys is free. There is no per-key charge and IAM authorization is not billed. $0 (free) |
| Secrets Manager storage (if used) | per secret per month | Storing the key in Secrets Manager for safe distribution adds a per-secret monthly fee plus API calls. $0.40 per secret per month + $0.05 per 10,000 API calls |
| Leaked-key blast radius | variable | Not an AWS line item but the real financial exposure. A compromised key can launch GPU fleets and data transfer that bill thousands of dollars per day until caught. $0 to tens of thousands (incident-driven) |
Optimization tips
Common ways to reduce aws_ cost without changing the workload.
Replace access keys with IAM roles wherever possible
Avoids the single largest source of surprise AWS billsWorkloads on EC2, ECS, Lambda, and EKS should use IAM roles that issue short-lived temporary credentials. Roles remove the static secret entirely and eliminate the leaked-key risk. Reserve access keys for on-premises or third-party tools that cannot assume a role.
Use OIDC federation for CI/CD instead of stored keys
GitHub Actions, GitLab, and other CI systems can assume an AWS role via OIDC, so no long-lived key is stored in the pipeline. This is both free and far safer than an aws_
Rotate and scope keys that must exist
If a key is unavoidable, rotate it on a schedule, attach a least-privilege policy, and add condition keys that restrict region and instance type so a leak cannot launch expensive resources.
Set a budget alarm and enable GuardDuty
A billing alarm and GuardDuty anomaly detection are the fastest way to catch a leaked key before the bill grows. GuardDuty is paid but cheap relative to a full incident; a basic AWS Budgets alert is free.
FAQ
Do IAM access keys cost anything?
No. Creating and using access keys is free, and the API calls they sign are not billed at the IAM layer. The financial risk is entirely about what happens if the key leaks, which is why teams minimize their use.
Why are leaked access keys so expensive?
A long-lived key carries the full permissions of its IAM user and never expires until rotated or deleted. Attackers scan public repositories and leaked logs for keys and immediately launch large GPU instances for crypto mining. Bills of tens of thousands of dollars within a day are documented.
What is the alternative to access keys?
IAM roles with temporary credentials. Use instance profiles for EC2, task roles for ECS, execution roles for Lambda, IRSA for EKS, and OIDC federation for CI. All are free and remove the static secret entirely.
Is the secret stored in Terraform state?
Yes. aws_
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_.