Skip to content

Secrets Manager  >  Operations  >  get_random_password

get_random_password

Operation

get_random_password async

get_random_password(input: GetRandomPasswordInput, plugins: list[Plugin] | None = None) -> GetRandomPasswordOutput

Generates a random password. We recommend that you specify the maximum length and include every character type that the system you are generating a password for can support. By default, Secrets Manager uses uppercase and lowercase letters, numbers, and the following characters in passwords: !"#$$%&'()*+,-./:;<=>?@[\]^_`{|}~

Secrets Manager generates a CloudTrail log entry when you call this action.

Required permissions: secretsmanager:GetRandomPassword. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.

Parameters:

Name Type Description Default
input GetRandomPasswordInput

An instance of GetRandomPasswordInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
GetRandomPasswordOutput

An instance of GetRandomPasswordOutput.

Input

GetRandomPasswordInput dataclass

Dataclass for GetRandomPasswordInput structure.

Attributes

exclude_characters class-attribute instance-attribute
exclude_characters: str | None = None

A string of the characters that you don't want in the password.

exclude_lowercase class-attribute instance-attribute
exclude_lowercase: bool | None = None

Specifies whether to exclude lowercase letters from the password. If you don't include this switch, the password can contain lowercase letters.

exclude_numbers class-attribute instance-attribute
exclude_numbers: bool | None = None

Specifies whether to exclude numbers from the password. If you don't include this switch, the password can contain numbers.

exclude_punctuation class-attribute instance-attribute
exclude_punctuation: bool | None = None

Specifies whether to exclude the following punctuation characters from the password: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~. If you don't include this switch, the password can contain punctuation.

exclude_uppercase class-attribute instance-attribute
exclude_uppercase: bool | None = None

Specifies whether to exclude uppercase letters from the password. If you don't include this switch, the password can contain uppercase letters.

include_space class-attribute instance-attribute
include_space: bool | None = None

Specifies whether to include the space character. If you include this switch, the password can contain space characters.

password_length class-attribute instance-attribute
password_length: int | None = None

The length of the password. If you don't include this parameter, the default length is 32 characters.

require_each_included_type class-attribute instance-attribute
require_each_included_type: bool | None = None

Specifies whether to include at least one upper and lowercase letter, one number, and one punctuation. If you don't include this switch, the password contains at least one of every character type.

Output

GetRandomPasswordOutput dataclass

Dataclass for GetRandomPasswordOutput structure.

Attributes

random_password class-attribute instance-attribute
random_password: str | None = field(repr=False, default=None)

A string with the password.