Created
August 1, 2022 09:56
-
-
Save shar1z/ecfa6348031db72f4635bbe1555917ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
data_layer.py - how to use the credentials | |
""" | |
from decorators import get_dynamodb_session_keys | |
def some_data_access_method(): | |
session = boto3.Session(**get_dynamodb_session_keys()) | |
dynamodb = session.resource("dynamodb") | |
table = dynamodb.Table(TABLE_NAME) | |
# now we can use 'table' to access with tenant_id restrictions | |
And then hooking it all together into our handler file: | |
""" | |
handler.py - applying to our lambda | |
""" | |
from decorators import dynamodb_tenant_isolation | |
@dynamodb_tenant_isolation | |
def handler(event, context): | |
# our lambda code | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment