1. Packages
  2. AWS
  3. API Docs
  4. iam
  5. AccountPasswordPolicy
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.iam.AccountPasswordPolicy

Explore with Pulumi AI

Note: There is only a single policy allowed per AWS account. An existing policy will be lost when using this resource as an effect of this limitation.

Manages Password Policy for the AWS Account. See more about Account Password Policy in the official AWS docs.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const strict = new aws.iam.AccountPasswordPolicy("strict", {
    minimumPasswordLength: 8,
    requireLowercaseCharacters: true,
    requireNumbers: true,
    requireUppercaseCharacters: true,
    requireSymbols: true,
    allowUsersToChangePassword: true,
});
Copy
import pulumi
import pulumi_aws as aws

strict = aws.iam.AccountPasswordPolicy("strict",
    minimum_password_length=8,
    require_lowercase_characters=True,
    require_numbers=True,
    require_uppercase_characters=True,
    require_symbols=True,
    allow_users_to_change_password=True)
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iam.NewAccountPasswordPolicy(ctx, "strict", &iam.AccountPasswordPolicyArgs{
			MinimumPasswordLength:      pulumi.Int(8),
			RequireLowercaseCharacters: pulumi.Bool(true),
			RequireNumbers:             pulumi.Bool(true),
			RequireUppercaseCharacters: pulumi.Bool(true),
			RequireSymbols:             pulumi.Bool(true),
			AllowUsersToChangePassword: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var strict = new Aws.Iam.AccountPasswordPolicy("strict", new()
    {
        MinimumPasswordLength = 8,
        RequireLowercaseCharacters = true,
        RequireNumbers = true,
        RequireUppercaseCharacters = true,
        RequireSymbols = true,
        AllowUsersToChangePassword = true,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.AccountPasswordPolicy;
import com.pulumi.aws.iam.AccountPasswordPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var strict = new AccountPasswordPolicy("strict", AccountPasswordPolicyArgs.builder()
            .minimumPasswordLength(8)
            .requireLowercaseCharacters(true)
            .requireNumbers(true)
            .requireUppercaseCharacters(true)
            .requireSymbols(true)
            .allowUsersToChangePassword(true)
            .build());

    }
}
Copy
resources:
  strict:
    type: aws:iam:AccountPasswordPolicy
    properties:
      minimumPasswordLength: 8
      requireLowercaseCharacters: true
      requireNumbers: true
      requireUppercaseCharacters: true
      requireSymbols: true
      allowUsersToChangePassword: true
Copy

Create AccountPasswordPolicy Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new AccountPasswordPolicy(name: string, args?: AccountPasswordPolicyArgs, opts?: CustomResourceOptions);
@overload
def AccountPasswordPolicy(resource_name: str,
                          args: Optional[AccountPasswordPolicyArgs] = None,
                          opts: Optional[ResourceOptions] = None)

@overload
def AccountPasswordPolicy(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          allow_users_to_change_password: Optional[bool] = None,
                          hard_expiry: Optional[bool] = None,
                          max_password_age: Optional[int] = None,
                          minimum_password_length: Optional[int] = None,
                          password_reuse_prevention: Optional[int] = None,
                          require_lowercase_characters: Optional[bool] = None,
                          require_numbers: Optional[bool] = None,
                          require_symbols: Optional[bool] = None,
                          require_uppercase_characters: Optional[bool] = None)
func NewAccountPasswordPolicy(ctx *Context, name string, args *AccountPasswordPolicyArgs, opts ...ResourceOption) (*AccountPasswordPolicy, error)
public AccountPasswordPolicy(string name, AccountPasswordPolicyArgs? args = null, CustomResourceOptions? opts = null)
public AccountPasswordPolicy(String name, AccountPasswordPolicyArgs args)
public AccountPasswordPolicy(String name, AccountPasswordPolicyArgs args, CustomResourceOptions options)
type: aws:iam:AccountPasswordPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args AccountPasswordPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args AccountPasswordPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args AccountPasswordPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args AccountPasswordPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. AccountPasswordPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var accountPasswordPolicyResource = new Aws.Iam.AccountPasswordPolicy("accountPasswordPolicyResource", new()
{
    AllowUsersToChangePassword = false,
    HardExpiry = false,
    MaxPasswordAge = 0,
    MinimumPasswordLength = 0,
    PasswordReusePrevention = 0,
    RequireLowercaseCharacters = false,
    RequireNumbers = false,
    RequireSymbols = false,
    RequireUppercaseCharacters = false,
});
Copy
example, err := iam.NewAccountPasswordPolicy(ctx, "accountPasswordPolicyResource", &iam.AccountPasswordPolicyArgs{
	AllowUsersToChangePassword: pulumi.Bool(false),
	HardExpiry:                 pulumi.Bool(false),
	MaxPasswordAge:             pulumi.Int(0),
	MinimumPasswordLength:      pulumi.Int(0),
	PasswordReusePrevention:    pulumi.Int(0),
	RequireLowercaseCharacters: pulumi.Bool(false),
	RequireNumbers:             pulumi.Bool(false),
	RequireSymbols:             pulumi.Bool(false),
	RequireUppercaseCharacters: pulumi.Bool(false),
})
Copy
var accountPasswordPolicyResource = new AccountPasswordPolicy("accountPasswordPolicyResource", AccountPasswordPolicyArgs.builder()
    .allowUsersToChangePassword(false)
    .hardExpiry(false)
    .maxPasswordAge(0)
    .minimumPasswordLength(0)
    .passwordReusePrevention(0)
    .requireLowercaseCharacters(false)
    .requireNumbers(false)
    .requireSymbols(false)
    .requireUppercaseCharacters(false)
    .build());
Copy
account_password_policy_resource = aws.iam.AccountPasswordPolicy("accountPasswordPolicyResource",
    allow_users_to_change_password=False,
    hard_expiry=False,
    max_password_age=0,
    minimum_password_length=0,
    password_reuse_prevention=0,
    require_lowercase_characters=False,
    require_numbers=False,
    require_symbols=False,
    require_uppercase_characters=False)
Copy
const accountPasswordPolicyResource = new aws.iam.AccountPasswordPolicy("accountPasswordPolicyResource", {
    allowUsersToChangePassword: false,
    hardExpiry: false,
    maxPasswordAge: 0,
    minimumPasswordLength: 0,
    passwordReusePrevention: 0,
    requireLowercaseCharacters: false,
    requireNumbers: false,
    requireSymbols: false,
    requireUppercaseCharacters: false,
});
Copy
type: aws:iam:AccountPasswordPolicy
properties:
    allowUsersToChangePassword: false
    hardExpiry: false
    maxPasswordAge: 0
    minimumPasswordLength: 0
    passwordReusePrevention: 0
    requireLowercaseCharacters: false
    requireNumbers: false
    requireSymbols: false
    requireUppercaseCharacters: false
Copy

AccountPasswordPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The AccountPasswordPolicy resource accepts the following input properties:

AllowUsersToChangePassword bool
Whether to allow users to change their own password
HardExpiry bool
Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
MaxPasswordAge int
The number of days that an user password is valid.
MinimumPasswordLength int
Minimum length to require for user passwords.
PasswordReusePrevention int
The number of previous passwords that users are prevented from reusing.
RequireLowercaseCharacters bool
Whether to require lowercase characters for user passwords.
RequireNumbers bool
Whether to require numbers for user passwords.
RequireSymbols bool
Whether to require symbols for user passwords.
RequireUppercaseCharacters bool
Whether to require uppercase characters for user passwords.
AllowUsersToChangePassword bool
Whether to allow users to change their own password
HardExpiry bool
Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
MaxPasswordAge int
The number of days that an user password is valid.
MinimumPasswordLength int
Minimum length to require for user passwords.
PasswordReusePrevention int
The number of previous passwords that users are prevented from reusing.
RequireLowercaseCharacters bool
Whether to require lowercase characters for user passwords.
RequireNumbers bool
Whether to require numbers for user passwords.
RequireSymbols bool
Whether to require symbols for user passwords.
RequireUppercaseCharacters bool
Whether to require uppercase characters for user passwords.
allowUsersToChangePassword Boolean
Whether to allow users to change their own password
hardExpiry Boolean
Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
maxPasswordAge Integer
The number of days that an user password is valid.
minimumPasswordLength Integer
Minimum length to require for user passwords.
passwordReusePrevention Integer
The number of previous passwords that users are prevented from reusing.
requireLowercaseCharacters Boolean
Whether to require lowercase characters for user passwords.
requireNumbers Boolean
Whether to require numbers for user passwords.
requireSymbols Boolean
Whether to require symbols for user passwords.
requireUppercaseCharacters Boolean
Whether to require uppercase characters for user passwords.
allowUsersToChangePassword boolean
Whether to allow users to change their own password
hardExpiry boolean
Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
maxPasswordAge number
The number of days that an user password is valid.
minimumPasswordLength number
Minimum length to require for user passwords.
passwordReusePrevention number
The number of previous passwords that users are prevented from reusing.
requireLowercaseCharacters boolean
Whether to require lowercase characters for user passwords.
requireNumbers boolean
Whether to require numbers for user passwords.
requireSymbols boolean
Whether to require symbols for user passwords.
requireUppercaseCharacters boolean
Whether to require uppercase characters for user passwords.
allow_users_to_change_password bool
Whether to allow users to change their own password
hard_expiry bool
Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
max_password_age int
The number of days that an user password is valid.
minimum_password_length int
Minimum length to require for user passwords.
password_reuse_prevention int
The number of previous passwords that users are prevented from reusing.
require_lowercase_characters bool
Whether to require lowercase characters for user passwords.
require_numbers bool
Whether to require numbers for user passwords.
require_symbols bool
Whether to require symbols for user passwords.
require_uppercase_characters bool
Whether to require uppercase characters for user passwords.
allowUsersToChangePassword Boolean
Whether to allow users to change their own password
hardExpiry Boolean
Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
maxPasswordAge Number
The number of days that an user password is valid.
minimumPasswordLength Number
Minimum length to require for user passwords.
passwordReusePrevention Number
The number of previous passwords that users are prevented from reusing.
requireLowercaseCharacters Boolean
Whether to require lowercase characters for user passwords.
requireNumbers Boolean
Whether to require numbers for user passwords.
requireSymbols Boolean
Whether to require symbols for user passwords.
requireUppercaseCharacters Boolean
Whether to require uppercase characters for user passwords.

Outputs

All input properties are implicitly available as output properties. Additionally, the AccountPasswordPolicy resource produces the following output properties:

ExpirePasswords bool
Indicates whether passwords in the account expire. Returns true if max_password_age contains a value greater than 0. Returns false if it is 0 or not present.
Id string
The provider-assigned unique ID for this managed resource.
ExpirePasswords bool
Indicates whether passwords in the account expire. Returns true if max_password_age contains a value greater than 0. Returns false if it is 0 or not present.
Id string
The provider-assigned unique ID for this managed resource.
expirePasswords Boolean
Indicates whether passwords in the account expire. Returns true if max_password_age contains a value greater than 0. Returns false if it is 0 or not present.
id String
The provider-assigned unique ID for this managed resource.
expirePasswords boolean
Indicates whether passwords in the account expire. Returns true if max_password_age contains a value greater than 0. Returns false if it is 0 or not present.
id string
The provider-assigned unique ID for this managed resource.
expire_passwords bool
Indicates whether passwords in the account expire. Returns true if max_password_age contains a value greater than 0. Returns false if it is 0 or not present.
id str
The provider-assigned unique ID for this managed resource.
expirePasswords Boolean
Indicates whether passwords in the account expire. Returns true if max_password_age contains a value greater than 0. Returns false if it is 0 or not present.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing AccountPasswordPolicy Resource

Get an existing AccountPasswordPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AccountPasswordPolicyState, opts?: CustomResourceOptions): AccountPasswordPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        allow_users_to_change_password: Optional[bool] = None,
        expire_passwords: Optional[bool] = None,
        hard_expiry: Optional[bool] = None,
        max_password_age: Optional[int] = None,
        minimum_password_length: Optional[int] = None,
        password_reuse_prevention: Optional[int] = None,
        require_lowercase_characters: Optional[bool] = None,
        require_numbers: Optional[bool] = None,
        require_symbols: Optional[bool] = None,
        require_uppercase_characters: Optional[bool] = None) -> AccountPasswordPolicy
func GetAccountPasswordPolicy(ctx *Context, name string, id IDInput, state *AccountPasswordPolicyState, opts ...ResourceOption) (*AccountPasswordPolicy, error)
public static AccountPasswordPolicy Get(string name, Input<string> id, AccountPasswordPolicyState? state, CustomResourceOptions? opts = null)
public static AccountPasswordPolicy get(String name, Output<String> id, AccountPasswordPolicyState state, CustomResourceOptions options)
resources:  _:    type: aws:iam:AccountPasswordPolicy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AllowUsersToChangePassword bool
Whether to allow users to change their own password
ExpirePasswords bool
Indicates whether passwords in the account expire. Returns true if max_password_age contains a value greater than 0. Returns false if it is 0 or not present.
HardExpiry bool
Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
MaxPasswordAge int
The number of days that an user password is valid.
MinimumPasswordLength int
Minimum length to require for user passwords.
PasswordReusePrevention int
The number of previous passwords that users are prevented from reusing.
RequireLowercaseCharacters bool
Whether to require lowercase characters for user passwords.
RequireNumbers bool
Whether to require numbers for user passwords.
RequireSymbols bool
Whether to require symbols for user passwords.
RequireUppercaseCharacters bool
Whether to require uppercase characters for user passwords.
AllowUsersToChangePassword bool
Whether to allow users to change their own password
ExpirePasswords bool
Indicates whether passwords in the account expire. Returns true if max_password_age contains a value greater than 0. Returns false if it is 0 or not present.
HardExpiry bool
Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
MaxPasswordAge int
The number of days that an user password is valid.
MinimumPasswordLength int
Minimum length to require for user passwords.
PasswordReusePrevention int
The number of previous passwords that users are prevented from reusing.
RequireLowercaseCharacters bool
Whether to require lowercase characters for user passwords.
RequireNumbers bool
Whether to require numbers for user passwords.
RequireSymbols bool
Whether to require symbols for user passwords.
RequireUppercaseCharacters bool
Whether to require uppercase characters for user passwords.
allowUsersToChangePassword Boolean
Whether to allow users to change their own password
expirePasswords Boolean
Indicates whether passwords in the account expire. Returns true if max_password_age contains a value greater than 0. Returns false if it is 0 or not present.
hardExpiry Boolean
Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
maxPasswordAge Integer
The number of days that an user password is valid.
minimumPasswordLength Integer
Minimum length to require for user passwords.
passwordReusePrevention Integer
The number of previous passwords that users are prevented from reusing.
requireLowercaseCharacters Boolean
Whether to require lowercase characters for user passwords.
requireNumbers Boolean
Whether to require numbers for user passwords.
requireSymbols Boolean
Whether to require symbols for user passwords.
requireUppercaseCharacters Boolean
Whether to require uppercase characters for user passwords.
allowUsersToChangePassword boolean
Whether to allow users to change their own password
expirePasswords boolean
Indicates whether passwords in the account expire. Returns true if max_password_age contains a value greater than 0. Returns false if it is 0 or not present.
hardExpiry boolean
Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
maxPasswordAge number
The number of days that an user password is valid.
minimumPasswordLength number
Minimum length to require for user passwords.
passwordReusePrevention number
The number of previous passwords that users are prevented from reusing.
requireLowercaseCharacters boolean
Whether to require lowercase characters for user passwords.
requireNumbers boolean
Whether to require numbers for user passwords.
requireSymbols boolean
Whether to require symbols for user passwords.
requireUppercaseCharacters boolean
Whether to require uppercase characters for user passwords.
allow_users_to_change_password bool
Whether to allow users to change their own password
expire_passwords bool
Indicates whether passwords in the account expire. Returns true if max_password_age contains a value greater than 0. Returns false if it is 0 or not present.
hard_expiry bool
Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
max_password_age int
The number of days that an user password is valid.
minimum_password_length int
Minimum length to require for user passwords.
password_reuse_prevention int
The number of previous passwords that users are prevented from reusing.
require_lowercase_characters bool
Whether to require lowercase characters for user passwords.
require_numbers bool
Whether to require numbers for user passwords.
require_symbols bool
Whether to require symbols for user passwords.
require_uppercase_characters bool
Whether to require uppercase characters for user passwords.
allowUsersToChangePassword Boolean
Whether to allow users to change their own password
expirePasswords Boolean
Indicates whether passwords in the account expire. Returns true if max_password_age contains a value greater than 0. Returns false if it is 0 or not present.
hardExpiry Boolean
Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
maxPasswordAge Number
The number of days that an user password is valid.
minimumPasswordLength Number
Minimum length to require for user passwords.
passwordReusePrevention Number
The number of previous passwords that users are prevented from reusing.
requireLowercaseCharacters Boolean
Whether to require lowercase characters for user passwords.
requireNumbers Boolean
Whether to require numbers for user passwords.
requireSymbols Boolean
Whether to require symbols for user passwords.
requireUppercaseCharacters Boolean
Whether to require uppercase characters for user passwords.

Import

Using pulumi import, import IAM Account Password Policy using the word iam-account-password-policy. For example:

$ pulumi import aws:iam/accountPasswordPolicy:AccountPasswordPolicy strict iam-account-password-policy
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.