Skip to content

Get Random Password

secretsmanager_get_random_password R Documentation

Generates a random password

Description

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.

[\: R:%5C%5C%5C [IAM policy actions for Secrets Manager]: R:IAM%20policy%20actions%20for%20Secrets%0AManager [Authentication and access control in Secrets Manager]: R:Authentication%20and%20access%20control%20in%20Secrets%0AManager

Usage

secretsmanager_get_random_password(PasswordLength, ExcludeCharacters,
  ExcludeNumbers, ExcludePunctuation, ExcludeUppercase, ExcludeLowercase,
  IncludeSpace, RequireEachIncludedType)

Arguments

PasswordLength

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

ExcludeCharacters

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

ExcludeNumbers

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

ExcludePunctuation

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

ExcludeUppercase

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

ExcludeLowercase

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

IncludeSpace

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

RequireEachIncludedType

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.

Value

A list with the following syntax:

list(
  RandomPassword = "string"
)

Request syntax

svc$get_random_password(
  PasswordLength = 123,
  ExcludeCharacters = "string",
  ExcludeNumbers = TRUE|FALSE,
  ExcludePunctuation = TRUE|FALSE,
  ExcludeUppercase = TRUE|FALSE,
  ExcludeLowercase = TRUE|FALSE,
  IncludeSpace = TRUE|FALSE,
  RequireEachIncludedType = TRUE|FALSE
)

Examples

## Not run: 
# 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.
svc$get_random_password(
  IncludeSpace = TRUE,
  PasswordLength = 20L,
  RequireEachIncludedType = TRUE
)

## End(Not run)