Guest User

Untitled

a guest
May 25th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import boto3
  2.  
  3. s3 = boto3.client('s3', region_name='ap-northeast-1')
  4.  
  5. def lambda_handler(event, context):
  6. bucket = '*xxxxxx*'
  7. key = 's3-upload.json'
  8. try:
  9. response = s3.get_object(Bucket=bucket, Key=key)
  10. print('--------------------------------------')
  11. print(response)
  12. print('--------------------------------------')
  13. body = response['Body'].read()
  14. print(body)
  15. print('--------------------------------------')
  16. print("CONTENT TYPE: " + response['ContentType'])
  17.  
  18. except Exception as e:
  19. print('Error getting object.')
  20. print(e)
  21. raise e
Add Comment
Please, Sign In to add comment