Use UpdateAccountPasswordPolicy with an Amazon SDK or CLI - Amazon Identity and Access Management
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use UpdateAccountPasswordPolicy with an Amazon SDK or CLI

The following code examples show how to use UpdateAccountPasswordPolicy.

CLI
Amazon CLI

To set or change the current account password policy

The following update-account-password-policy command sets the password policy to require a minimum length of eight characters and to require one or more numbers in the password.

aws iam update-account-password-policy \ --minimum-password-length 8 \ --require-numbers

This command produces no output.

Changes to an account's password policy affect any new passwords that are created for IAM users in the account. Password policy changes do not affect existing passwords.

For more information, see Setting an account password policy for IAM users in the Amazon IAM User Guide.

PowerShell
Tools for PowerShell

Example 1: This example updates the password policy for the account with the specified settings. Note that any parameters that are not included in the command are not left unmodified. Instead, they are reset to default values.

Update-IAMAccountPasswordPolicy -AllowUsersToChangePasswords $true -HardExpiry $false -MaxPasswordAge 90 -MinimumPasswordLength 8 -PasswordReusePrevention 20 -RequireLowercaseCharacters $true -RequireNumbers $true -RequireSymbols $true -RequireUppercaseCharacters $true

For a complete list of Amazon SDK developer guides and code examples, see Using IAM with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.