Description
pw_max_age sets the maximum age of an IAM user’s console password. A value of 0 leaves expiration off. Access keys have a separate lifecycle.
Potential impact
Setting or shortening the limit immediately expires passwords already older than that limit. Those users need a new password at their next sign-in.
Remediation
If your organization requires expiration, set pw_max_age or its alias password_max_age to 1–1,095 days. Check password-change and recovery procedures first. Keep MFA in place and replace exposed passwords immediately.
Examples
The first two tasks are alternatives. The first uses the module default of 0, the second sets 180 days, and the final example uses 20 days.
Before
- 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_reuse_prevent: 5
pw_expire: false
- name: Configure a second IAM password policy example
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: 180
pw_reuse_prevent: 5
pw_expire: false
After
- 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: 20
pw_reuse_prevent: 5
pw_expire: false
pw_expire: false lets eligible users change an expired password through the console. pw_max_age still controls when it expires.