How To Generate Random Passwords Using AWS Secret Manager API

How To Generate Random Passwords Using AWS Secret Manager API

How To Generate Random Passwords Using AWS Secret Manager API

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

Did you know, you can use AWS Secret Manager GetRandomPassword API action to generate a random password for you. Today we will discuss how to generate random passwords using AWS secret manager API.

AWS Secret Manager provides API action GetRandomPassword to generate a random password using API call. You can also define the password length, special characters and other parameter with this API action to define your password strength. And the best part is it almost free (You can generate 10000 passwords for only 0.05$). We will use AWS CLI in this demo to generate a random password, below is the syntax and options to provide with the AWS CLI command.

Syntax:

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.

How To Generate Random Passwords In AWS Using Secret Manager:

Prerequisites:

  • AWS CLI installed and configured with proper access. You can use below link to install and configure AWS CLI.

https://cloudaffaire.com/how-to-install-aws-cli/

https://cloudaffaire.com/how-to-configure-aws-cli/

Generate A Random Password Using API:

Note: This feature is only available through API and you cannot generate a random password from AWS management console. If you are using a different SDK, please refer documentation for the API details.

Hope you have enjoyed this article. To know more about AWS Secret Manager, please refer below official documentation

https://docs.aws.amazon.com/secretsmanager/index.html

Leave a Reply

Close Menu