javascriptv3/example_code/rekognition/estimate-age-example/src/README.md
Amazon Rekognition makes it easy to add image and video analysis to your applications using AWS SDK for JavaScript version 3 (v3).
This example demonstrates how to estimate the ages of faces in an photo.
Clone the AWS SDK Code Samples repo to your local environment. See the Github documentation for instructions.
Install the dependencies listed in the package.json.
Note: These include the client module for the AWS services required in these example, which are @aws-sdk/client-cognito-identity, @aws-sdk/credential-provider-cognito-identity, and @aws-sdk/client-rekognition, and Webpack for bundling your Node.js and Javascript.
npm install node -g
cd javascriptv3/example_code/rekognition/estimate-age-example/src
npm install
aws cloudformation create-stack --stack-name STACK_NAME --template-body file://setup.yaml --capabilities CAPABILITY_IAM
Note: The stack name must be unique within an AWS Region and AWS account. You can specify up to 128 characters, and numbers and hyphens are allowed.
Open the AWS CloudFormation Console, choose the stack, and choose the Resources tab.
Copy the Physical ID of the CognitoDefaultUnauthenticatedRole.
In the estimate-age.js file, replace IDENTITY_POOL_ID with the Physical ID of the CognitoDefaultUnauthenticatedRole.
In the libs/rekognitionClient.js file, replace REGION with your AWS Region.
Use Webpack to bundle the Node.js modules required for the example by running the following in the command line:
webpack estimate-age.js --mode development --target web --devtool false -o main.js