Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues to use DynamoRM in cross account lambda. #113

Open
WyllianNeo opened this issue Dec 23, 2023 · 1 comment
Open

Issues to use DynamoRM in cross account lambda. #113

WyllianNeo opened this issue Dec 23, 2023 · 1 comment

Comments

@WyllianNeo
Copy link

Hello.
I´m working in a refactor of a project using DynamoRM in lambdas and it works fine. But in my refactor, I'm facing error while use that in cross account (lambda with lib in account B accessing Dynamo in account A).
If I do it directly with boto3, passing the proper roles created to it, it works fine.
I tried set/override boto3 configurations of DynamoRM but without success, and did not found any documentation of how do it (or if is possible).
Can you guys can answer me if is possible do it, and if yes, how, please?
If need more information about it (current code, tests done, error, etc), please let me know.

@BrandonHigbee
Copy link

BrandonHigbee commented Jan 10, 2024

@WyllianNeo I recently faced this and was able to get it to work by patching the properties on the DynamoTable3 object on initialization to force my role name to be used:

from dynamorm.table import DynamoTable3

DynamoTable3.session_kwargs = {"profile_name": "your-role-name-with-dynamo-access-here"}  # type: ignore

EDIT: Realizing now that this setup was used when an aws config file is present that specifies the profile details. This might not work for your use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants