For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/cloudformation-aws-iam-policies-attached-to-user.md.
A documentation index is available at /llms.txt.
Directly attaching IAM policies to individual users increases management complexity and raises the risk of privilege sprawl and inconsistent access control. Centralizing permissions onto groups or roles makes audits and least-privilege enforcement easier. This rule checks AWS CloudFormation AWS::IAM::User resources and requires that Properties.Policies (inline policies) and Properties.ManagedPolicyArns (managed policy ARNs) are undefined or empty. Resources that define non-empty Policies or ManagedPolicyArns will be flagged; instead attach managed or inline policies to AWS::IAM::Group or AWS::IAM::Role and assign users to those groups or have them assume roles to receive permissions.
Secure configuration example (attach policies to a group and add the user to the group):