Skip to content

IndexFaces

Source: src/AWS/Rekognition/IndexFaces.ts

Runtime binding for rekognition:IndexFaces — detect faces in an image and add them to a face collection for later search.

The binding takes no arguments and grants the function rekognition:IndexFaces on * (Rekognition data-plane resources such as collections, users, and jobs are routinely created at runtime, so their identifiers are unknown at deploy time). Provide the implementation with Effect.provide(AWS.Rekognition.IndexFacesHttp).

// init
const indexFaces = yield* AWS.Rekognition.IndexFaces();
// runtime
const result = yield* indexFaces({
CollectionId: "tenant-42",
Image: { S3Object: { Bucket: "photos", Name: "profile.jpg" } },
ExternalImageId: userId,
});
const faceIds = (result.FaceRecords ?? []).map((r) => r.Face?.FaceId);