Created
November 6, 2019 02:12
-
-
Save djg07/8f8455c4268f48c9eccad23854a1b563 to your computer and use it in GitHub Desktop.
Handler
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
#Talk python to me | |
import json | |
import boto3 | |
s3 = boto3.client('s3') | |
def lambda_handler(event, context): | |
bucket = 'aws-simplified-transactions' | |
key = 'transactions.json' | |
response = s3.get_object(Bucket=bucket, Key=key) | |
content = response['Body'] | |
jsonObject = json.loads(content.read()) | |
transactions = jsonObject['transactions'] | |
for record in transactions: | |
print("TransactionType: " + record['transactionType']) | |
print("TransactionAmount: " + str(record['amount'])) | |
print("---") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment