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-group-without-users.md.
A documentation index is available at /llms.txt.
IAM groups should have at least one user assigned so that group permissions are actively used and auditable. Empty groups can hide orphaned or over-permissive permission sets and increase the risk of unintended access if the group is later reused.
This rule checks CloudFormation templates and requires each AWS::IAM::Group to be referenced by at least one AWS::IAM::User via the user’s Groups property. AWS::IAM::Group resources with no such references will be flagged.
If group membership is managed outside CloudFormation (for example, by an external identity provider) or a group is intentionally created empty for future use, document that intent or manage membership through IaC to avoid false positives.
AWSTemplateFormatVersion:"2010-09-09"Description:A user is attached to the group through a short-form Ref intrinsicResources:developers:Type:AWS::IAM::GroupProperties:Path:"/"developerUser:Type:AWS::IAM::UserProperties:UserName:developer-userGroups:- !Ref developers