Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . secretsmanager ]

get-random-password

Description

Generates a random password of the specified complexity. This operation is intended for use in the Lambda rotation function. Per best practice, we recommend that you specify the maximum length and include every character type that the system you are generating a password for can support.

Minimum permissions

To run this command, you must have the following permissions:

  • secretsmanager:GetRandomPassword

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  get-random-password
[--password-length <value>]
[--exclude-characters <value>]
[--exclude-numbers | --no-exclude-numbers]
[--exclude-punctuation | --no-exclude-punctuation]
[--exclude-uppercase | --no-exclude-uppercase]
[--exclude-lowercase | --no-exclude-lowercase]
[--include-space | --no-include-space]
[--require-each-included-type | --no-require-each-included-type]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--password-length (long)

The desired length of the generated password. The default value if you do not include this parameter is 32 characters.

--exclude-characters (string)

A string that includes characters that should not be included in the generated password. The default is that all characters from the included sets can be used.

--exclude-numbers | --no-exclude-numbers (boolean)

Specifies that the generated password should not include digits. The default if you do not include this switch parameter is that digits can be included.

--exclude-punctuation | --no-exclude-punctuation (boolean)

Specifies that the generated password should not include punctuation characters. The default if you do not include this switch parameter is that punctuation characters can be included.

The following are the punctuation characters that can be included in the generated password if you don't explicitly exclude them with ExcludeCharacters or ExcludePunctuation :

! " # $ % ' ( ) * + , - . / : ; = ? @ [ \ ] ^ _ ` { | } ~

--exclude-uppercase | --no-exclude-uppercase (boolean)

Specifies that the generated password should not include uppercase letters. The default if you do not include this switch parameter is that uppercase letters can be included.

--exclude-lowercase | --no-exclude-lowercase (boolean)

Specifies that the generated password should not include lowercase letters. The default if you do not include this switch parameter is that lowercase letters can be included.

--include-space | --no-include-space (boolean)

Specifies that the generated password can include the space character. The default if you do not include this switch parameter is that the space character is not included.

--require-each-included-type | --no-require-each-included-type (boolean)

A boolean value that specifies whether the generated password must include at least one of every allowed character type. The default value is True and the operation requires at least one of every character type.

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

To generate a random password

The following example shows how to request a randomly generated password. This example includes the optional flags to require spaces and at least one character of each included type. It specifies a length of 20 characters.

aws secretsmanager get-random-password --include-space --password-length 20 --require-each-included-type

The output shows the following:

{
  "RandomPassword": "N+Z43a,>vx7j O8^*<8i3"
}

Output

RandomPassword -> (string)

A string with the generated password.