aws-lambda

Python AWS Lambda 301 redirect

只谈情不闲聊 提交于 2019-12-22 08:58:00
问题 I have a lambda handler written in Python and I wish to perform a 301 redirect to the browser. I have no idea how I can configure the response Location header (or the status code) -- the documentation doesn't seem to cover anything in context object other than some properties. Apparently context.succeed works with Node JS but this doesn't help in Python. Returning: {"Location": "http://google.com/"} causes the API gateway to report: Fri Dec 09 16:20:53 UTC 2016 : Execution failed due to

send email when user registers - AWS Cognito federated Identities

和自甴很熟 提交于 2019-12-22 08:49:40
问题 How can i send an email/trigger a lambda function when a new user registers? Under "edit identity pool" i only found a sync trigger. If i understand correctly: This one is triggered every time a user syncs his data... Is there any way to trigger a lambda function only for the "initial" sync or when a certain dataset is created for the user? Edit: To be more specific: I do create the user via lambdas using the JS SDK. I use developer authentication with my own oauth2 flow. I don't know how to

Recommended Project Structure for multi-function SAM Template

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 08:47:47
问题 I have a new project that requires a relatively small amount of services, maybe 10 or less (and therefore it is not economical to place each in a separate project repository). Each service will be defined as an AWS::Serverless::Function via SAM Template. My question is: what is the recommended way to organize or structure such a project? Currently the structure is: |- src |- lambdas |- service-one |- stuff |- package.json |- service-two |- stuff |- package.json |- other-stuff |- test |-

Invoking the lambda gets timed out after adding VPC configurations

纵饮孤独 提交于 2019-12-22 07:09:11
问题 I am using serverless framework for creating lambdas. I created a simple Lambda function, which queries from an mongo instance and returns the response. Initially, I created the mongo instance with publicIp and made the Lambda access that instance with publicIP. It worked well. Now, in order to increase the security, I added the VPC configuration to the Lambda. Here is my serverless.yml: functions: graphql: handler: handler.graphql iamRoleStatements: - Effect: Allow Resource: "*" Action: -

Increase invoke Response payload size in AWS Lambda to 15 mb

北慕城南 提交于 2019-12-22 06:59:20
问题 As per current implementation by AWS, the response payload size returned by a Lambda function cannot exceed 6 mb . Is there a provision for increasing this limit to 15 mb by requesting a "Service Limit Increase". Also, what are the additional charges, if any that would be charged? Thanks in advance! 回答1: no. But you can upload the result to S3 and return the s3 bucket name + key so the caller of the Lambda can download the result from S3 which can handle files of that size without any issues.

How to use AWS KMS in AWS lambda

眉间皱痕 提交于 2019-12-22 05:15:22
问题 I've just started to work with AWS services, particularly AWS Lambda. Is there a way to use AWS KMS service from within Lambda code (Java). I'd like to use KMS to decrypt an encrypted externalized (read from a property) secret. My Lambda code is in java. Thanks in advance. 回答1: Yes, it should work fine. I recently ported a Node.js RESTful API over to Lambda and didn't have to change any KMS code. You'll just need to make sure the role your Lambda function runs under has permissions to the key

POST JSON object to aws lambda

落爺英雄遲暮 提交于 2019-12-22 04:43:25
问题 How can I post a json object to aws lambda function through aws API gateway ? p.s.- My goal is to write the lambda function in python and then post it to aws SQS. Thanks in advance. 回答1: I figured it out. Now I have a API Gateway acceptiong client posted JSON data of a specified format and then passing it to a AWS-Lambda function which, dumps the data into a AWS-SQS. The steps are explained below in details- STEP 1- Create a lambda function in any supported languages (I have used Python 3.6).

AWS Lambda: Error: getaddrinfo ENOTFOUND

守給你的承諾、 提交于 2019-12-22 04:42:53
问题 here's the code in AWS Lambda function: var https = require('https'); exports.handler = (event, context, callback) => { var params = { host: "bittrex.com", path: "/api/v1.1/public/getmarketsummaries" }; var req = https.request(params, function(res) { var test = res.toString(); console.log(JSON.parse(test)); //console.log(JSON.parse(res.toString())); }); req.end(); }; Error: getaddrinfo ENOTFOUND https://bittrex.com https://bittrex.com:443 at errnoException (dns.js:28:10) at GetAddrInfoReqWrap

Cannot add code to AWS Lambda function using CloudFormation

懵懂的女人 提交于 2019-12-22 04:19:17
问题 I'm trying to create the Cloud Formation Stack. The Stack was deployed correctly. Lambda function was created, but the code is not getting added as inline to the function. It says Your Lambda function "lambda_function" cannot be edited inline since the file name specified in the handler does not match a file name in your deployment package. Cloud Formation Code: LambdaFunction: Type: "AWS::Lambda::Function" Properties: Code: ZipFile: !Sub | import json def lambda_handler(event,context):

How do I assign function level IamRoleStatements in Serverless Framework?

你。 提交于 2019-12-22 04:07:23
问题 I want to assign different permissions for different functions listed in my serverless.yml functions: hello: handler: handler.hello crawl-distributor: handler: CrawlDistributor.handler product-scanner: handler: ProductScanner.handler iamRoleStatements: - Effect: Allow Action: - dynamodb:* - lambda:* Resource: "*" This doesn't seem to work. When I add the iamRoleStatements at the provider level, it works, but ends up applying the permissions to all the functions. provider: name: aws runtime: