Skip to content

Instantly share code, notes, and snippets.

View heiwad's full-sized avatar

Heiwad Osman heiwad

  • New York, NY
View GitHub Profile
@heiwad
heiwad / Lab 2 Python Presigned url
Last active June 9, 2021 03:25
s3 presigned url
def generate_presigned_url(s3, bucketname, key):
import boto3
from botocore.client import Config
region = 'us-east-2'
s3 = boto3.client(
's3',
endpoint_url=f'https://s3.{region}.amazonaws.com',
config=Config(s3={'addressing_style': 'virtual'}))
@heiwad
heiwad / lambda_function.py
Created June 7, 2018 21:25
Lambda function (python 2.7) to print back the parameters it receives.
import json
def lambda_handler(event, context):
print('Received event: ' + json.dumps(event, indent=2))
response = {
"statusCode":200,
"headers": { "Access-Control-Allow-Origin": " *", "Content-Type" : 'application/json' },
"body": json.dumps(event)
}