Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
323 views
in Technique[技术] by (71.8m points)

Amazon Textract, Elastic Beanstalk -assumed-role/aws-elasticbeanstalk-ec2-role/... is not authorized to perform textract:AnalyzeDocument

Hi I have build an app in spring boot that uses amazon textract for getting table data from a pdf file. This app works correctly when it is installed on my localhost. Now i have created a new Elastic Beanstalk app on the AWS environment and uploaded my spring jar on there. When i call the url for the app i can verify that the app is there but when i call any of the endpoints that in turn call the textract service i get a permissions error.

User: arn:aws:sts::1234:assumed-role/aws-elasticbeanstalk-ec2-role/i-1234 is not authorized to perform textract:AnalyzeDocument (Service: Textract, Status Code: 400, Request ID: 123xyz, Extended Request ID: null)

Can anyone give me advice as to how / where i can set this up?

Thanks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

When you run a Spring Boot application on Elastic Beanstalk, you need to make sure you are setting your service client properly. If you do not, you encounter issues. For example, here is a way to create a service client for Amazon DynamoDB for the Java V2 client:

 DynamoDbClient ddb = DynamoDbClient.builder()
            .region(region)
            .credentialsProvider(EnvironmentVariableCredentialsProvider.create())
            .build(); 

You can set up environment variables on Elastic Beanstalk so that the service client is successfully created. More information here:

Creating your first AWS Java web application


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...