Faceliveness Back-End Access Denied

0

Hi Guys,

I was trying to replicate the face liveness request to create a liveness session, followed the code given on the document set the appropriate permissions on IAM but still I get AccessDenied error/except.

I someone here created the same Back-End, I how you can help me. Thank you in advance.

6개 답변
1

@Riku, I tried both the permission but still get the same error. Here is my IAM Enter image description here

I'm not sure if that two policy are having a conflict or maybe missing something.

JP
답변함 9달 전
0

Hello.
Would it be possible for you to share the error message and the IAM policy and code you are using?

profile picture
전문가
답변함 9달 전
  • Thank you for sharing. I created and executed a Lambda in the same way in my environment and the situation was reproduced. The following policy with full access was able to run, so something may be missing in the policy.

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "VisualEditor0",
                "Effect": "Allow",
                "Action": [
                    "rekognition:*"
                ],
                "Resource": "*"
            }
        ]
    }
    
  • "StartFaceLivenessSession" was required in the IAM policy. Reading the "CreateFaceLivenessSession" document, it seems that it is supposed to start streaming Face Liveness video, so I think this permission is required. https://docs.aws.amazon.com/rekognition/latest/APIReference/API_CreateFaceLivenessSession.html The error message was not very user friendly and was hard to understand...

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "VisualEditor0",
                "Effect": "Allow",
                "Action": [
                    "rekognition:StartFaceLivenessSession",
                    "rekognition:CreateFaceLivenessSession",
                    "rekognition:GetFaceLivenessSessionResults"
                ],
                "Resource": "*"
            }
        ]
    }
    
  • It is odd that it fails even with full access. Can you confirm that the IAM role associated with Lambda is correct? I am able to run it in my environment.

0

Hmm..., the role is attached correctly, at this point I can't think of anything missing. Btw, thank you for you help.

Lambda IAM Role

JP
답변함 9달 전
  • did you solve this? Same problem when i have done everything like the official doc said.

0

Thank you for the response @Riku, please see below the error message return by the lambda function that I'm calling to get the liveness session.

{"errorMessage": "An error occurred (AccessDeniedException) when calling the CreateFaceLivenessSession operation: ", "errorType": "AccessDeniedException", "requestId": "7aad255e-ba03-4d42-acee-ecefaf85da36", "stackTrace": ["  File \"/var/task/lambda_function.py\", line 18, in lambda_handler\n    'sessionId': create_session()\n", "  File \"/var/task/lambda_function.py\", line 6, in create_session\n    response = client.create_face_liveness_session()\n", "  File \"/var/task/botocore/client.py\", line 535, in _api_call\n    return self._make_api_call(operation_name, kwargs)\n", "  File \"/var/task/botocore/client.py\", line 980, in _make_api_call\n    raise error_class(parsed_response, operation_name)\n"]}

Also, here are the following IAM policy that the lambda is using.

{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Sid": "VisualEditor0",
			"Effect": "Allow",
			"Action": [
				"rekognition:CreateFaceLivenessSession",
				"rekognition:GetFaceLivenessSessionResults"
			],
			"Resource": "*"
		}
	]
}

The code that I'm using came from the docs, Calling the Face liveness API's https://docs.aws.amazon.com/rekognition/latest/dg/face-liveness-calling-apis.html

import boto3

client = boto3.client('rekognition')

def create_session():
    response = client.create_face_liveness_session()
    session_id = response.get("SessionId")

    return session_id

def lambda_handler(event, context):
    return {
        'statusCode': 200,
        'sessionId': create_session()
    }

Can't figure out why it throws Access Denied exception even if I set the IAM policy the way the documents shows.

JP
답변함 9달 전
0

Same problem. Did anyone solve this ??? I did everything same way on the aws official document said.

Suhe
답변함 2달 전
0

I'm also having an AccessDeniedException when using CreateFaceLivenessSessionCommand with Javascript v3. My iAM role already have all actions and resources of rekognition, i can use the ListFacesCommand, IndexFacesCommand and SearchFacesByImageCommand because my role have all of the rekognition but when calling the CreateFaceLivenessSessionCommand it shows AccessDeniedException. what seems the problem?

AJ
답변함 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠