AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::Cognito::UserPoolUserToGroupAttachment

CfnUserPoolUserToGroupAttachment

Adds a user to a group. A user who is in a group can present a preferred-role claim to an identity pool, and populates a `cognito:groups` claim to their access and identity tokens. > Amazon Cognito evaluates AWS Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. > > **Learn more** - [Signing AWS API Requests](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-signing.html) > - [Using the Amazon Cognito user pools API and user pool endpoints](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pools-API-operations.html)

Import

import { CfnUserPoolUserToGroupAttachment } from 'aws-cdk-lib/aws-cognito';

Or use the module namespace:

import * as cognito from 'aws-cdk-lib/aws-cognito';
// cognito.CfnUserPoolUserToGroupAttachment

Properties

Configuration passed to the constructor as CfnUserPoolUserToGroupAttachmentProps.

groupNameRequired
string | IUserPoolGroupRef

The name of the group that you want to add your user to.

usernameRequired
string | IUserPoolUserRef

The user's username.

userPoolIdRequired
string | IUserPoolRef

The ID of the user pool that contains the group that you want to add the user to.

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Get the Amazon Cognito Cheat Sheet

Everything you need to know about Amazon Cognito on one page. HD quality, print-friendly.

Download Free Infographic