1. Packages
  2. AWS
  3. API Docs
  4. cognito
  5. getUserGroups
AWS v6.78.0 published on Thursday, Apr 24, 2025 by Pulumi

aws.cognito.getUserGroups

Explore with Pulumi AI

Data source for managing AWS Cognito IDP (Identity Provider) User Groups.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = aws.cognito.getUserGroups({
    userPoolId: "us-west-2_aaaaaaaaa",
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.cognito.get_user_groups(user_pool_id="us-west-2_aaaaaaaaa")
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cognito"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cognito.GetUserGroups(ctx, &cognito.GetUserGroupsArgs{
			UserPoolId: "us-west-2_aaaaaaaaa",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = Aws.Cognito.GetUserGroups.Invoke(new()
    {
        UserPoolId = "us-west-2_aaaaaaaaa",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cognito.CognitoFunctions;
import com.pulumi.aws.cognito.inputs.GetUserGroupsArgs;
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 example = CognitoFunctions.getUserGroups(GetUserGroupsArgs.builder()
            .userPoolId("us-west-2_aaaaaaaaa")
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:cognito:getUserGroups
      arguments:
        userPoolId: us-west-2_aaaaaaaaa
Copy

Using getUserGroups

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 getUserGroups(args: GetUserGroupsArgs, opts?: InvokeOptions): Promise<GetUserGroupsResult>
function getUserGroupsOutput(args: GetUserGroupsOutputArgs, opts?: InvokeOptions): Output<GetUserGroupsResult>
Copy
def get_user_groups(user_pool_id: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetUserGroupsResult
def get_user_groups_output(user_pool_id: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetUserGroupsResult]
Copy
func GetUserGroups(ctx *Context, args *GetUserGroupsArgs, opts ...InvokeOption) (*GetUserGroupsResult, error)
func GetUserGroupsOutput(ctx *Context, args *GetUserGroupsOutputArgs, opts ...InvokeOption) GetUserGroupsResultOutput
Copy

> Note: This function is named GetUserGroups in the Go SDK.

public static class GetUserGroups 
{
    public static Task<GetUserGroupsResult> InvokeAsync(GetUserGroupsArgs args, InvokeOptions? opts = null)
    public static Output<GetUserGroupsResult> Invoke(GetUserGroupsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetUserGroupsResult> getUserGroups(GetUserGroupsArgs args, InvokeOptions options)
public static Output<GetUserGroupsResult> getUserGroups(GetUserGroupsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:cognito/getUserGroups:getUserGroups
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

UserPoolId This property is required. string
User pool the client belongs to.
UserPoolId This property is required. string
User pool the client belongs to.
userPoolId This property is required. String
User pool the client belongs to.
userPoolId This property is required. string
User pool the client belongs to.
user_pool_id This property is required. str
User pool the client belongs to.
userPoolId This property is required. String
User pool the client belongs to.

getUserGroups Result

The following output properties are available:

Groups List<GetUserGroupsGroup>
List of groups. See groups below.
Id string
User pool identifier.
UserPoolId string
Groups []GetUserGroupsGroup
List of groups. See groups below.
Id string
User pool identifier.
UserPoolId string
groups List<GetUserGroupsGroup>
List of groups. See groups below.
id String
User pool identifier.
userPoolId String
groups GetUserGroupsGroup[]
List of groups. See groups below.
id string
User pool identifier.
userPoolId string
groups Sequence[GetUserGroupsGroup]
List of groups. See groups below.
id str
User pool identifier.
user_pool_id str
groups List<Property Map>
List of groups. See groups below.
id String
User pool identifier.
userPoolId String

Supporting Types

GetUserGroupsGroup

Description This property is required. string
Description of the user group.
GroupName This property is required. string
Name of the user group.
Precedence This property is required. int
Precedence of the user group.
RoleArn This property is required. string
ARN of the IAM role to be associated with the user group.
Description This property is required. string
Description of the user group.
GroupName This property is required. string
Name of the user group.
Precedence This property is required. int
Precedence of the user group.
RoleArn This property is required. string
ARN of the IAM role to be associated with the user group.
description This property is required. String
Description of the user group.
groupName This property is required. String
Name of the user group.
precedence This property is required. Integer
Precedence of the user group.
roleArn This property is required. String
ARN of the IAM role to be associated with the user group.
description This property is required. string
Description of the user group.
groupName This property is required. string
Name of the user group.
precedence This property is required. number
Precedence of the user group.
roleArn This property is required. string
ARN of the IAM role to be associated with the user group.
description This property is required. str
Description of the user group.
group_name This property is required. str
Name of the user group.
precedence This property is required. int
Precedence of the user group.
role_arn This property is required. str
ARN of the IAM role to be associated with the user group.
description This property is required. String
Description of the user group.
groupName This property is required. String
Name of the user group.
precedence This property is required. Number
Precedence of the user group.
roleArn This property is required. String
ARN of the IAM role to be associated with the user group.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.