Configuring Amazon Rekognition Video - Amazon Rekognition

Configuring Amazon Rekognition Video

To use the Amazon Rekognition Video API with stored videos, you have to configure the IAM user and an IAM service role to access your Amazon SNS topics. You also have to subscribe an Amazon SQS queue to your Amazon SNS topics.

Note

If you're using these instructions to set up the Analyzing a video stored in an Amazon S3 bucket with Java or Python (SDK) example, you don't need to do steps 3, 4, 5, and 6. The example includes code to create and configure the Amazon SNS topic and Amazon SQS queue.

The examples in this section create a new Amazon SNS topic by using the instructions that give Amazon Rekognition Video access to multiple topics. If you want to use an existing Amazon SNS topic, use Giving access to an existing Amazon SNS topic for step 3.

To configure Amazon Rekognition Video

  1. Set up an AWS account to access Amazon Rekognition Video. For more information, see Step 1: Set up an AWS account and create an IAM user.

    Ensure the user has at least the following permissions:

    • AmazonSQSFullAccess

    • AmazonRekognitionFullAccess

    • AmazonS3FullAccess

    • AmazonSNSFullAccess

  2. Install and configure the required AWS SDK. For more information, see Step 2: Set up the AWS CLI and AWS SDKs.

  3. Create an Amazon SNS topic by using the Amazon SNS console. Prepend the topic name with AmazonRekognition. Note the topic Amazon Resource Name (ARN). Ensure the topic is in the same region as the AWS endpoint that you are using.

  4. Create an Amazon SQS standard queue by using the Amazon SQS console. Note the queue ARN.

  5. Subscribe the queue to the topic you created in step 3.

  6. Give permission to the Amazon SNS topic to send messages to the Amazon SQS queue.

  7. Create an IAM service role to give Amazon Rekognition Video access to your Amazon SNS topics. Note the Amazon Resource Name (ARN) of the service role. For more information, see Giving access to multiple Amazon SNS topics.

  8. Add the following inline policy to the IAM user that you created in step 1:

    { "Version": "2012-10-17", "Statement": [ { "Sid": "MySid", "Effect": "Allow", "Action": "iam:PassRole", "Resource": "arn:Service role ARN from step 7" } ] }

    Give the inline policy a name of your choosing.

  9. You can now run the examples in Analyzing a video stored in an Amazon S3 bucket with Java or Python (SDK) and Analyzing a video with the AWS Command Line Interface.

Giving access to multiple Amazon SNS topics

You use an IAM service role to give Amazon Rekognition Video access to Amazon SNS topics that you create. IAM provides the Rekognition use case for creating an Amazon Rekognition Video service role.

You can give Amazon Rekognition Video access to multiple Amazon SNS topics by using the AmazonRekognitionServiceRole permissions policy and prepending the topic names with AmazonRekognition—for example, AmazonRekognitionMyTopicName.

To give Amazon Rekognition Video access to multiple Amazon SNS topics

  1. Create an IAM service role. Use the following information to create the IAM service role:

    1. Choose Rekognition for the service name.

    2. Choose Rekognition for the service role use case. You should see the AmazonRekognitionServiceRole permissions policy listed. AmazonRekognitionServiceRole gives Amazon Rekognition Video access to Amazon SNS topics that are prefixed with AmazonRekognition.

    3. Give the service role a name of your choosing.

  2. Note the ARN of the service role. You need it to start video analysis operations.

Giving access to an existing Amazon SNS topic

You can create a permissions policy that allows Amazon Rekognition Video access to an existing Amazon SNS topic.

To give Amazon Rekognition Video access to an existing Amazon SNS topic

  1. Create a new permissions policy with the IAM JSON policy editor, and use the following policy. Replace topicarn with the Amazon Resource Name (ARN) of the desired Amazon SNS topic.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sns:Publish" ], "Resource": "topicarn" } ] }
  2. Create an IAM service role, or update an existing IAM service role. Use the following information to create the IAM service role:

    1. Choose Rekognition for the service name.

    2. Choose Rekognition for the service role use case.

    3. Attach the permissions policy you created in step 1.

  3. Note the ARN of the service role. You need it to start video analysis operations.