0
votes

While accessing a cross account resource in aws. There are two ways - 1.role as a proxy 2.resource based access. DynamoDb does not support resource based access for cross account access. So we have to do role as a proxy option and do assume role in our code. But the issue is when we do assume role we get securtiy credentials which are temporary and lasts for maximum 1 hour. That means in my code I have to renew the assumerole access and get new credentials every 1 hour or when I get resource access exception This seems problematic when my dynamodbclient is shared among multiple threads . Is there a way to get access permanently on cross account dynamodb without need of renew the session.

2

2 Answers

0
votes

You could just initialize your DynamoDB client with credentials (access key and secret key) from an IAM user you created in the other AWS account (the account the DynamoDB table resides in).

0
votes

Though this is an old thread that I stumble upon. But STS launched longer role sessions where you can assume a role (could be cross-account in your case) for up to 12 hours. I hope that should resolve your problem.