AWS v6.73.0 published on Wednesday, Mar 19, 2025 by Pulumi
aws.secretsmanager.getRandomPassword
Explore with Pulumi AI
Generate a random password.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = aws.secretsmanager.getRandomPassword({
    passwordLength: 50,
    excludeNumbers: true,
});
import pulumi
import pulumi_aws as aws
test = aws.secretsmanager.get_random_password(password_length=50,
    exclude_numbers=True)
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/secretsmanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := secretsmanager.GetRandomPassword(ctx, &secretsmanager.GetRandomPasswordArgs{
			PasswordLength: pulumi.IntRef(50),
			ExcludeNumbers: pulumi.BoolRef(true),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var test = Aws.SecretsManager.GetRandomPassword.Invoke(new()
    {
        PasswordLength = 50,
        ExcludeNumbers = true,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.secretsmanager.SecretsmanagerFunctions;
import com.pulumi.aws.secretsmanager.inputs.GetRandomPasswordArgs;
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) {
        final var test = SecretsmanagerFunctions.getRandomPassword(GetRandomPasswordArgs.builder()
            .passwordLength(50)
            .excludeNumbers(true)
            .build());
    }
}
variables:
  test:
    fn::invoke:
      function: aws:secretsmanager:getRandomPassword
      arguments:
        passwordLength: 50
        excludeNumbers: true
Using getRandomPassword
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getRandomPassword(args: GetRandomPasswordArgs, opts?: InvokeOptions): Promise<GetRandomPasswordResult>
function getRandomPasswordOutput(args: GetRandomPasswordOutputArgs, opts?: InvokeOptions): Output<GetRandomPasswordResult>def get_random_password(exclude_characters: Optional[str] = None,
                        exclude_lowercase: Optional[bool] = None,
                        exclude_numbers: Optional[bool] = None,
                        exclude_punctuation: Optional[bool] = None,
                        exclude_uppercase: Optional[bool] = None,
                        include_space: Optional[bool] = None,
                        password_length: Optional[int] = None,
                        require_each_included_type: Optional[bool] = None,
                        opts: Optional[InvokeOptions] = None) -> GetRandomPasswordResult
def get_random_password_output(exclude_characters: Optional[pulumi.Input[str]] = None,
                        exclude_lowercase: Optional[pulumi.Input[bool]] = None,
                        exclude_numbers: Optional[pulumi.Input[bool]] = None,
                        exclude_punctuation: Optional[pulumi.Input[bool]] = None,
                        exclude_uppercase: Optional[pulumi.Input[bool]] = None,
                        include_space: Optional[pulumi.Input[bool]] = None,
                        password_length: Optional[pulumi.Input[int]] = None,
                        require_each_included_type: Optional[pulumi.Input[bool]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetRandomPasswordResult]func GetRandomPassword(ctx *Context, args *GetRandomPasswordArgs, opts ...InvokeOption) (*GetRandomPasswordResult, error)
func GetRandomPasswordOutput(ctx *Context, args *GetRandomPasswordOutputArgs, opts ...InvokeOption) GetRandomPasswordResultOutput> Note: This function is named GetRandomPassword in the Go SDK.
public static class GetRandomPassword 
{
    public static Task<GetRandomPasswordResult> InvokeAsync(GetRandomPasswordArgs args, InvokeOptions? opts = null)
    public static Output<GetRandomPasswordResult> Invoke(GetRandomPasswordInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetRandomPasswordResult> getRandomPassword(GetRandomPasswordArgs args, InvokeOptions options)
public static Output<GetRandomPasswordResult> getRandomPassword(GetRandomPasswordArgs args, InvokeOptions options)
fn::invoke:
  function: aws:secretsmanager/getRandomPassword:getRandomPassword
  arguments:
    # arguments dictionaryThe following arguments are supported:
- ExcludeCharacters string
- String of the characters that you don't want in the password.
- ExcludeLowercase bool
- Specifies whether to exclude lowercase letters from the password.
- ExcludeNumbers bool
- Specifies whether to exclude numbers from the password.
- ExcludePunctuation bool
- Specifies whether to exclude the following punctuation characters from the password: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ .
- ExcludeUppercase bool
- Specifies whether to exclude uppercase letters from the password.
- IncludeSpace bool
- Specifies whether to include the space character.
- PasswordLength int
- Length of the password.
- RequireEach boolIncluded Type 
- Specifies whether to include at least one upper and lowercase letter, one number, and one punctuation.
- ExcludeCharacters string
- String of the characters that you don't want in the password.
- ExcludeLowercase bool
- Specifies whether to exclude lowercase letters from the password.
- ExcludeNumbers bool
- Specifies whether to exclude numbers from the password.
- ExcludePunctuation bool
- Specifies whether to exclude the following punctuation characters from the password: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ .
- ExcludeUppercase bool
- Specifies whether to exclude uppercase letters from the password.
- IncludeSpace bool
- Specifies whether to include the space character.
- PasswordLength int
- Length of the password.
- RequireEach boolIncluded Type 
- Specifies whether to include at least one upper and lowercase letter, one number, and one punctuation.
- excludeCharacters String
- String of the characters that you don't want in the password.
- excludeLowercase Boolean
- Specifies whether to exclude lowercase letters from the password.
- excludeNumbers Boolean
- Specifies whether to exclude numbers from the password.
- excludePunctuation Boolean
- Specifies whether to exclude the following punctuation characters from the password: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ .
- excludeUppercase Boolean
- Specifies whether to exclude uppercase letters from the password.
- includeSpace Boolean
- Specifies whether to include the space character.
- passwordLength Integer
- Length of the password.
- requireEach BooleanIncluded Type 
- Specifies whether to include at least one upper and lowercase letter, one number, and one punctuation.
- excludeCharacters string
- String of the characters that you don't want in the password.
- excludeLowercase boolean
- Specifies whether to exclude lowercase letters from the password.
- excludeNumbers boolean
- Specifies whether to exclude numbers from the password.
- excludePunctuation boolean
- Specifies whether to exclude the following punctuation characters from the password: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ .
- excludeUppercase boolean
- Specifies whether to exclude uppercase letters from the password.
- includeSpace boolean
- Specifies whether to include the space character.
- passwordLength number
- Length of the password.
- requireEach booleanIncluded Type 
- Specifies whether to include at least one upper and lowercase letter, one number, and one punctuation.
- exclude_characters str
- String of the characters that you don't want in the password.
- exclude_lowercase bool
- Specifies whether to exclude lowercase letters from the password.
- exclude_numbers bool
- Specifies whether to exclude numbers from the password.
- exclude_punctuation bool
- Specifies whether to exclude the following punctuation characters from the password: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ .
- exclude_uppercase bool
- Specifies whether to exclude uppercase letters from the password.
- include_space bool
- Specifies whether to include the space character.
- password_length int
- Length of the password.
- require_each_ boolincluded_ type 
- Specifies whether to include at least one upper and lowercase letter, one number, and one punctuation.
- excludeCharacters String
- String of the characters that you don't want in the password.
- excludeLowercase Boolean
- Specifies whether to exclude lowercase letters from the password.
- excludeNumbers Boolean
- Specifies whether to exclude numbers from the password.
- excludePunctuation Boolean
- Specifies whether to exclude the following punctuation characters from the password: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ .
- excludeUppercase Boolean
- Specifies whether to exclude uppercase letters from the password.
- includeSpace Boolean
- Specifies whether to include the space character.
- passwordLength Number
- Length of the password.
- requireEach BooleanIncluded Type 
- Specifies whether to include at least one upper and lowercase letter, one number, and one punctuation.
getRandomPassword Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- RandomPassword string
- Random password.
- ExcludeCharacters string
- ExcludeLowercase bool
- ExcludeNumbers bool
- ExcludePunctuation bool
- ExcludeUppercase bool
- IncludeSpace bool
- PasswordLength int
- RequireEach boolIncluded Type 
- Id string
- The provider-assigned unique ID for this managed resource.
- RandomPassword string
- Random password.
- ExcludeCharacters string
- ExcludeLowercase bool
- ExcludeNumbers bool
- ExcludePunctuation bool
- ExcludeUppercase bool
- IncludeSpace bool
- PasswordLength int
- RequireEach boolIncluded Type 
- id String
- The provider-assigned unique ID for this managed resource.
- randomPassword String
- Random password.
- excludeCharacters String
- excludeLowercase Boolean
- excludeNumbers Boolean
- excludePunctuation Boolean
- excludeUppercase Boolean
- includeSpace Boolean
- passwordLength Integer
- requireEach BooleanIncluded Type 
- id string
- The provider-assigned unique ID for this managed resource.
- randomPassword string
- Random password.
- excludeCharacters string
- excludeLowercase boolean
- excludeNumbers boolean
- excludePunctuation boolean
- excludeUppercase boolean
- includeSpace boolean
- passwordLength number
- requireEach booleanIncluded Type 
- id str
- The provider-assigned unique ID for this managed resource.
- random_password str
- Random password.
- exclude_characters str
- exclude_lowercase bool
- exclude_numbers bool
- exclude_punctuation bool
- exclude_uppercase bool
- include_space bool
- password_length int
- require_each_ boolincluded_ type 
- id String
- The provider-assigned unique ID for this managed resource.
- randomPassword String
- Random password.
- excludeCharacters String
- excludeLowercase Boolean
- excludeNumbers Boolean
- excludePunctuation Boolean
- excludeUppercase Boolean
- includeSpace Boolean
- passwordLength Number
- requireEach BooleanIncluded Type 
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.