I have a problem with using API of the AWS MediaConvert
When we create a job in MediaConvert we must define an IAM role. The role supposed to give access to s3 and AmazonAPIGatewayInvokeFullAccess
. This role will be automatically be created when we use the AWS Console of MediaConvert. I am trying to create a job using MediaConvert API but it returns an error "Cross-account pass role is not allowed.".
The API credentials are a user's secret key and id which is in the same account that MediaConvert is. From what I figured from googling. this error happens when another account is trying to use the role. Therefore, knowing that the user is one of the users defined in the same account, I tried to add the user to the trust relationship of the role. but it didn't work. The user that I am using has full access to MediaConvert.
I am using PHP
and this is how my code is:
$accountId = "xxxxxxxx";
$client = new MediaConvertClient([
'version' => "2017-08-29",
'region' => 'us-east-3',
'credentials' => new Credentials('xxxxxxxxx', 'xxxxxxxxx'),
'endpoint' => "https://xxxxx.mediaconvert.us-east-2.amazonaws.com",
]);
$settings = [
"OutputGroups"=> [
[
'CustomName' => 'mp3-converter',
"Name"=> "File Group",
"Outputs"=> [
[
"ContainerSettings"=> [
"Container"=> "RAW"
],
"AudioDescriptions"=> [
[
"AudioSourceName"=> "Audio Selector 1",
"CodecSettings"=> [
"Codec"=> "MP3",
"Mp3Settings"=> [
"Bitrate"=> 96000,
"RateControlMode"=> "CBR",
"SampleRate"=> 48000
]
]
]
],
"Extension"=> "mp3",
"NameModifier"=> "2"
]
],
"OutputGroupSettings"=> [
"Type"=> "FILE_GROUP_SETTINGS",
"FileGroupSettings"=> [
"Destination"=> "test/audio.mp3"
]
]
]
],
"Inputs"=> [
[
"AudioSelectors"=> [
"Audio Selector 1"=> [
"DefaultSelection"=> "DEFAULT"
]
],
"TimecodeSource"=> "ZEROBASED",
"FileInput"=> "test/audio.webm"
]
]
];
$job = $client->createJob([
'Role' => "arn:aws:iam::$accountId:role/service-role/MediaConvert_Default_Role",
'Settings' => $settings,
'Queue' => "arn:aws:mediaconvert:us-east-2:$accountId:queues/Default",
'UserMetadata' => [],
'Tags' => [],
'StatusUpdateInterval' => 'SECONDS_60',
'Priority' => 0,
]);
What do you think my problem is?