aws-lambda

Hyperlink in response card button in Amazon Lex

这一生的挚爱 提交于 2020-01-24 10:14:31
问题 I am trying to make a response card in amazon lex to give out a response card that has a button that leads to another website. Below is the code that I have used in aws lambda python. I have published the chatbot on facebook messenger. But whenever I select the button in fb messenger, the link in the button does not seem to bring me to the website. Is there any way to make the response card button turn into hyperlink button? def location(intent_request): session_attributes = intent_request[

Does AWS Lambda charge for the time spent initializing code?

試著忘記壹切 提交于 2020-01-24 08:44:48
问题 If my Lambda function written in Python takes 1.8 seconds to initialize (during a cold start) and 400 ms to execute, am I charged for the 400 ms execution time or the entire 2.2 seconds of initialization + execution time? From X-Ray, I see: From CloudWatch logs, I see: Duration: 404.42 ms Billed Duration: 500 ms Memory Size: 448 MB Max Memory Used: 113 MB What I understand from this is that I was billed for 500ms of execution time, so does that mean code initialization (e.g. importing stuff)

Does AWS Lambda charge for the time spent initializing code?

橙三吉。 提交于 2020-01-24 08:44:29
问题 If my Lambda function written in Python takes 1.8 seconds to initialize (during a cold start) and 400 ms to execute, am I charged for the 400 ms execution time or the entire 2.2 seconds of initialization + execution time? From X-Ray, I see: From CloudWatch logs, I see: Duration: 404.42 ms Billed Duration: 500 ms Memory Size: 448 MB Max Memory Used: 113 MB What I understand from this is that I was billed for 500ms of execution time, so does that mean code initialization (e.g. importing stuff)

AWS Lambda not invoked when subscribed SNS message is large

元气小坏坏 提交于 2020-01-24 07:40:16
问题 I've got a AWS lambda function that takes a large array of email addresses and submits them to SES for sending. The function is invoked via a SNS subscription. It works nicely when the message's email array size is small, however when the message's email array size is large the lambda function is NOT invoked. No logging occurs.... I've confirmed that the payload is below the SNS message size required, and I've subscribed to the SNS topic via my email...this works. I get emailed the expected

How to disable default log messages from lambda in python

会有一股神秘感。 提交于 2020-01-24 03:55:25
问题 I have an AWS Lambda function written in python, and i need only the messages I log in CloudWatch Logs. I have tried the example given in watchtower, but it still didn't work. START RequestId: d0ba05dc-8506-11e8-82ab-afe2adba36e5 Version: $LATEST (randomiser) Hello from Lambda END RequestId: d0ba05dc-8506-11e8-82ab-afe2adba36e5 REPORT RequestId: d0ba05dc-8506-11e8-82ab-afe2adba36e5 Duration: 0.44 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 21 MB* From the above I only need

Connection pooling in AWS across lambdas

一个人想着一个人 提交于 2020-01-24 03:44:13
问题 We know lambdas are charged by the execution time. So now I want to connect to SQL Server DB from lambda. If I create a connection in each lambda, it would be heavy for lambda. Is there any best way to maintain my SQL connections alive in one place and will be able to use across my all lambdas. Or at least alive for one lambda for multiple executions. I know, lambdas should be treated like stateless, but still, I am looking for a better solution for this issue. I have searched over many sites

cURL on AWS Lambda gives command not found error

不问归期 提交于 2020-01-24 00:54:07
问题 Starting a few hours today, a simple curl command on Lambda is failing. Lambda environment is NodeJs 10.x (have also tried in 12.x). const { execSync } = require('child_process'); exports.handler = async (event) => { execSync('curl http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg -o /tmp/BigBuckBunny.jpg'); const response = { statusCode: 200, body: JSON.stringify('Hello from Lambda!'), }; return response; }; I get a /bin/sh curl: command not found error

How to call module.exports from handler in AWS Lambda (Node.js)

时光怂恿深爱的人放手 提交于 2020-01-23 13:52:47
问题 That's what says in AWS: The module-name.export value in your function. For example, "index.handler" calls exports.handler in index.js. And it correctly calls this function: exports.handler = (username, password) => { ... } But what if the code is like this: module.exports = (username, password) => { ... } How do I call it? Nothing I tried works like module.exports , module.handler , etc. 回答1: AWS Lambda expects your module to export an object that contains a handler function. In your Lambda

How to call module.exports from handler in AWS Lambda (Node.js)

本秂侑毒 提交于 2020-01-23 13:51:10
问题 That's what says in AWS: The module-name.export value in your function. For example, "index.handler" calls exports.handler in index.js. And it correctly calls this function: exports.handler = (username, password) => { ... } But what if the code is like this: module.exports = (username, password) => { ... } How do I call it? Nothing I tried works like module.exports , module.handler , etc. 回答1: AWS Lambda expects your module to export an object that contains a handler function. In your Lambda

AWS Lambda and IAM error on deploy: The role defined for the function cannot be assumed by Lambda

爱⌒轻易说出口 提交于 2020-01-23 13:24:48
问题 In my AWS project, I use the serverless framework to deploy lambda function and IAM roles. So I created 6 lambda functions, all using the same IAM Role below: functions: auto-delete-identity: handler: src/auto-delete-identity.handler role: arn:aws:iam::123456789012:role/lambdaIAMRole name: auto-delete-identity auto-move-to-user-group: handler: src/auto-move-to-user-group.handler role: arn:aws:iam::123456789012:role/lambdaIAMRole name: auto-move-to-user-group auto-validate-user-creation: