How to enable DynamoDB using Roles instead of accesskey?
If I wanted to use the project spring-data-dynamodb as a lambda service. How can I make the DynamoDB client to make use of roles instead of access key and secret key?
@vivekkannan05 could you please let us know to which article you're referring to?
@maibin : Thanks you for replying. This is the article(https://www.baeldung.com/spring-data-dynamodb). I'm talking about. In this article we are connecting to Spring Boot application to DynamoDB using Accesskey and secret keys, Say if we are hosting this application in EC2 or lambda then we can use roles. In that case, what would be the best option to make use of roles instead of access key and secret access key. I think this would help many Java developers who would like to make their application serverless.
I was not able to add a comment in the article, that is why raised an issue here. https://www.baeldung.com/spring-data-dynamodb https://github.com/eugenp/tutorials/tree/master/persistence-modules/spring-data-dynamodb
Thanks.
@vivekkannan05 , I don't know how roles work in combination with a local DynamoDB instance.
However, with a deployment on Lambda and the AWS-operated DynamoDB, it works for me to just use the default constructor of AmazonDynamoDBClient() in the DynamoDBConfig, without the credentials. Of course, the Lambda function needs an according role attached to it (I guess that the same works for a deployment on EC2).
Please be also advised that the AmazonDynamoDBClient is deprecated now, and you should use AmazonDynamoDBClientBuilder instead.
@vivekkannan05 does it answer your question?
@maibin & @markusgulden It works. It was my mistake that I had missed to include DynamoDBMapper. Thanks guys for your time.