Created
June 23, 2020 16:40
-
-
Save jsonw23/ab31a283f39956545691b0ca06e1565c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import os | |
import json | |
import boto3 | |
def lambda_handler(event, context): | |
# environment variables are native, so use a language-specific | |
# method to access them, not the lambda context | |
table = os.environ['TABLE_NAME'] | |
# use the AWS SDK to scan the table by name | |
client = boto3.client('dynamodb') | |
response = client.scan(TableName=table) | |
# dump the scan response into the http response | |
return { | |
"statusCode": 200, | |
"body": json.dumps(response), | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment