Posts

Showing posts with the label aws-lambda

AWS Lambda how do I properly allow CORs?

Image
Clash Royale CLAN TAG #URR8PPP AWS Lambda how do I properly allow CORs? I know this question gets asked a lot and I have looked through other questions/answers but I still can't get it to work. I have read and followed: https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html This is my lambda function: let http = require('https') exports.handler = (event, context, callback) => { const STORE_HASH = '1234' const PATH = `/stores/${STORE_HASH}/v3/catalog/products?limit=100` const AUTH_TOKEN = '1234' const AUTH_CLIENT = '1324' let options = { "method": "GET", "hostname": "api.bigcommerce.com", "port": null, "path": PATH, "headers": { "x-auth-client": AUTH_CLIENT, "x-auth-token": AUTH_TOKEN, "content-type": "application/json", ...

Iterating a list of lists within Python for aws lambda

Image
Clash Royale CLAN TAG #URR8PPP Iterating a list of lists within Python for aws lambda I have a question related to python. The use case is to write a python function (in aws lambda) which will look for a set of files in multiple buckets and return some action like creating a dummy file in s3 bucket or triggering another lambda. For eg: list1=[file1,file2,file3] list2=[file4,file5,file6] list3=[f7,f8,f9] def lambda_handler(event,context): if len(list1)==9: print("something") //create dummy file in s3 OR, trigger another lambda elif len(list2)==9: print("Something") else: print("all files are not available") and like wise. I am a bit confused about how to do iteration within the 3lists and trigger one lambda for one set of file say list1 or list2 or list3. Or alternatively I can create a dummy file in s3. Can anyone please help me with the way to do it? Could you please clarify your question? Are you asking how to w...