AWS Secrets Manager IAM Integration
What you'll learn: How to control who and what can access your secrets in AWS Secrets Manager using IAM policies, resource policies, and cross-account patterns.
The Access Control Layer
AWS Secrets Manager doesn't just store secrets—it enforces strict access control through IAM integration. Think of it like a bank vault: the vault exists (your secret), but you need both proper identification (IAM identity) and explicit permission (policies) to open specific safety deposit boxes inside.
Three Ways to Control Access
1. IAM Identity Policies
Attach policies to IAM users, groups, or roles that define what they can do with Secrets Manager:
{
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue",
"secretsmanager:DescribeSecret"
],
"Resource": "arn:aws:secretsmanager:us-east-1:123456789012:secret:prod/db/*"
}
2. Resource Policies
Attach policies directly to secrets to define who can access them—useful for cross-account scenarios:
{
"Principal": {"AWS": "arn:aws:iam::999888777666:role/AppRole"},
"Effect": "Allow",
"Action": "secretsmanager:GetSecretValue",
"Resource": "*"
}
3. Cross-Account Access Patterns
Combine both: Account B's role has identity permissions and Account A's secret has a resource policy allowing Account B. Both gates must open for access to work.
Common Patterns
- Least privilege: Grant only
GetSecretValue, not administrative actions likeDeleteSecret - Condition keys: Restrict access by VPC endpoint, IP range, or time
- Service roles: Allow Lambda, ECS, or EC2 to retrieve secrets using their execution roles
Key Takeaway: AWS Secrets Manager security relies on layered IAM controls—identity policies define capabilities, resource policies define permissions, and cross-account access requires coordination of both, ensuring secrets are only accessible to explicitly authorized identities.