-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsg_lambda.py
More file actions
27 lines (21 loc) · 815 Bytes
/
sg_lambda.py
File metadata and controls
27 lines (21 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from __future__ import print_function
import boto3
import logging
import ast
import glob
import uuid
import random
from urllib.parse import urlparse
ENDPOINT="https://webscaledemo.netapp.com"
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def lambda_handler(event, context):
sgObj = event['Records'][0]['Sns']['Message']
message = ast.literal_eval(sgObj)
assetID = str(uuid.uuid4())
sourceS3Bucket = message['Records'][0]['s3']['bucket']['name']
sourceS3Key = message['Records'][0]['s3']['object']['key']
sourceS3 = ENDPOINT + '/'+ sourceS3Bucket + '/' + sourceS3Key #build a pre-signed URL in production
logger.info("Source S3 Bucket : %s", sourceS3Bucket)
logger.info("Source S3 Key : %s", sourceS3Key)
logger.info("S3 Object Source : %s", sourceS3)