Skip to content

Instantly share code, notes, and snippets.

@tluv2006
Forked from djg07/handler.py
Created May 25, 2023 17:58
Show Gist options
  • Save tluv2006/393f730dfb6f14a972d3a8f77384b29e to your computer and use it in GitHub Desktop.
Save tluv2006/393f730dfb6f14a972d3a8f77384b29e to your computer and use it in GitHub Desktop.
Handler
#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