Reputation: 7384
When I enter the example code from here https://docs.aws.amazon.com/de_de/translate/latest/dg/async.html
$ aws translate start-text-translation-job --job-name batch-test \
--source-language-code en \
--target-language-codes fr \
--input-data-config S3Uri=s3://input-bucket-name/folder,ContentType=text/plain \
--output-data-config S3Uri=s3://output-bucket-name/ \
--data-access-role-arn arn:aws:iam::012345678901:role/service-role/AmazonTranslateInputOutputAccess
Then the following error is throw:
An error occurred (InvalidRequestException) when calling the StartTextTranslationJob operation: Translate is not authorized to assume role: arn:aws:iam::012345678901:role/service-role/AmazonTranslateInputOutputAccess. Please update the role's trust policy.
The role AmazonTranslateInputOutputAccess is already created but anyhow should be affect the thrown error.
Upvotes: 1
Views: 2069
Reputation: 99
Adding this will fix the issue.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowTranslation",
"Effect": "Allow",
"Resource": "*",
"Action": "translate:*"
}
]
}
If You want to auto detect the source language and translate the text, then you also have to add the comprehend action in your Iam role.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowTranslation",
"Effect": "Allow",
"Resource": "*",
"Action": [ "translate:*", "comprehend:*" ]
}
]
}
Upvotes: 1
Reputation: 7384
Could fix it by adding a trust policy of:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "translate.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Upvotes: 2