AWS Transcrible in Boto3

Viewed 501

I am having a question regarding the DataAccessRoleArn setting in boto3 start_transcription_job function

Here is my code below:

transcribe.start_transcription_job(TranscriptionJobName=transcriptname,                                        
                                            Media = {"MediaFileUri": s3_url},
                                            MediaFormat = file_type,
                                            OutputBucketName = outputbucket,
                                            Settings={
                                                'ShowSpeakerLabels':True,
                                                'MaxSpeakerLabels':2
                                            },
                                            JobExecutionSettings ={
                                                'AllowDeferredExecution':True,
                                                'DataAccessRoleArn':'arn:aws:iam::358110801253:role/service-role/transcribe-role-k5easa7b'
                                            },
                                            LanguageCode = language)

If I comment out JobExecutionSettings portion, it works perfectly. But I want to turn on the AllowDeferredExecution so that I have to assign a DataAccessRoleArn. The role I assign here have full access to lambda and S3, but I am still receiving an Error like below:

[ERROR] ClientError: An error occurred (AccessDeniedException) when calling the StartTranscriptionJob operation: User: arn:aws:sts::358110801253:assumed-role/transcribe-role-k5easa7b/transcribe is not authorized to perform: iam:PassRole on resource: arn:aws:iam::358110801253:role/service-role/transcribe-role-k5easa7b
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 43, in lambda_handler
    transcribe.start_transcription_job(TranscriptionJobName=transcriptname,
  File "/var/runtime/botocore/client.py", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/var/runtime/botocore/client.py", line 626, in _make_api_call
    raise error_class(parsed_response, operation_name)END RequestId: 88e3bb78-60c1-42e5-a2e1-717918b6f7b9
0 Answers
Related