Skip to content

Instantly share code, notes, and snippets.

@djg07
Created November 6, 2019 02:12
Show Gist options
  • Save djg07/8f8455c4268f48c9eccad23854a1b563 to your computer and use it in GitHub Desktop.
Save djg07/8f8455c4268f48c9eccad23854a1b563 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