Review IAM password minimum length

Check that IAM console password length meets the organization’s account-protection requirements.

Description

min_pw_length sets the minimum length of IAM users’ console passwords. A custom policy accepts 6–128 characters. Root passwords and access keys fall outside this policy.

Potential impact

A low minimum can allow easily guessed passwords. Raising it affects existing users when they next change their password.

Remediation

Set min_pw_length or its alias minimum_password_length to your organization’s requirement. Check the effective length and character rules in the account policy and require MFA for console users.

Examples

Before

yaml
- name: Configure the IAM password policy
  community.aws.iam_password_policy:
    state: present
    require_symbols: false
    require_numbers: true
    require_uppercase: true
    require_lowercase: true
    allow_pw_change: true
    pw_max_age: 60
    pw_reuse_prevent: 5
    pw_expire: false

- name: Configure a second IAM password policy example
  community.aws.iam_password_policy:
    state: present
    min_pw_length: 6
    require_symbols: false
    require_numbers: true
    require_uppercase: true
    require_lowercase: true
    allow_pw_change: true
    pw_max_age: 60
    pw_reuse_prevent: 5
    pw_expire: false

After

yaml
- name: Configure the IAM password policy
  community.aws.iam_password_policy:
    state: present
    min_pw_length: 8
    require_symbols: false
    require_numbers: true
    require_uppercase: true
    require_lowercase: true
    allow_pw_change: true
    pw_max_age: 60
    pw_reuse_prevent: 5
    pw_expire: false

The first two tasks use the module default of 6 or explicitly set 6. The final task uses 8 as an example.

References