简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM