You can use the CreateUser operation to create a new user in a collection using a unique user ID you provide. You can then associate multiple faces with the newly created user.
To create a user (SDK)
-
If you haven't already:
-
Create or update an IAM user account with
AmazonRekognitionFullAccess
permissions. For more information, see Step 1: Set up an AWS account and create a User. -
Install and configure the AWS CLI and the AWS SDKs. For more information, see Step 2: Set up the AWS CLI and AWS SDKs.
-
-
Use the following examples to call the
CreateUser
operation.This Java code example creates a user.
import com.amazonaws.services.rekognition.AmazonRekognition; import com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder; import com.amazonaws.services.rekognition.model.CreateUserRequest; import com.amazonaws.services.rekognition.model.CreateUserResult; public class CreateUser { public static void main(String[] args) throws Exception { AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient(); //Replace collectionId and userId with the name of the user that you want to create in that target collection. String collectionId = "MyCollection"; String userId = "demoUser"; System.out.println("Creating new user: " + userId); CreateUserRequest request = new CreateUserRequest() .withCollectionId(collectionId) .withUserId(userId); rekognitionClient.createUser(request); } }