how to associate lamda function to bot alias in amazon lex? - amazon-web-services

I'm recently working on creating a bot with Amazon Lex. Reading the aws tutorials, I saw that they were outdated. This wasn't a problem till I needed to hook a aws lambda function to my intent fulfillment. I discovered that I need to hook the lambda function to a bot alias (witch I created, but have not discovered how to hook the function) to be able to test the bot. I'm stuck on this problem. I would appreciate if someone that has already built a bot could explain me how to hook the lambda function to the bot intent.

I am going to assume that you're working with version 2 of AWS Lex. A lot of people are experiencing the issue of associating a Lambda function with a Lex bot.
AWS have chosen a pretty weird way to configure this.
Please take a look at this answer that I had previously written on how to link a Lambda function to your Lex bot: https://stackoverflow.com/a/73621837/8880593

{
action: "lambda:InvokeFunction",
principal: new iam.AnyPrincipal(),
}
Add this permission to your lambda
If it works, you can limit your principal later on

Related

triggering AWS lambda using dashboard

Ok I am new to AWS. I am building a dashboard. It will also be an UI to trigger lambda functions. I see that there's native dashboarding software called quicksight. Does it allow command to trigger lambda functions?
I am thinking of falling back to flask or django. Does anyone has a better suggestion? Thank you so much in advance.

How to capture serverless website screenshot using AWS Lambda?

How to run an AWS Lambda function on a regular basis that saves screenshot of the webpage of a given specific URL?
Because your question is so generic - I'm just going to provide you the resources that I used to produce a similar lambda function for myself.
Getting puppeteer into Lambda
https://github.com/alixaxel/chrome-aws-lambda
Taking screenshots in Puppeteer
https://www.scrapehero.com/how-to-take-screenshots-of-a-web-page-using-puppeteer/
Then just run your job on a cron or queue it up however you would like and then dump the screenshot into S3
Good luck!

How to monitor website status with AWS Lambda and CloudWatch?

I have to monitor a website if it works - response looks like following:
{"response":
{"time": 1457564305},
"stat": "OK"
}
And need sending mail alert to me if stat is not OK.
Seems this can be done with Lambda using node.js and CloudWatch.
I tried to create Lambda function and execute through CloudWatch but only see the function was triggered. Seems I need to push some metrics?
I'm newbie to node.js and Lambda (handler, metrics, etc.).
Would anyone share some hints on where I should start with?
Thanks a lot.
Not sure what you mean by "only see the function was triggered".
Yes, you can cause a Lambda function to be invoked on a schedule. That Lambda function could issue a request to the website and trigger a notification to an SNS topic if it believes the site to be down. You would subscribe (by email address or SMS) to the SNS topic for notifications. Here's an example of how to do this.

What happens to request in the middle of an aws lambda update?

If I:
Trigger an AWS Lambda deployment/update
Trigger a request to AWS Lambda prior to step #1 finishing
Will the request just hit the old lambda? Will it error out?
So far in my testing it seems like there is no "downtime", that it swaps out the old for the new almost instantly--although the first request on the new lambda does have to do a cold start.
You are correct. IIRC, each function invocation uses a specific function ARN, which changes when you update the function. When you invoke the function, you're using the new ARN, which invokes only the new version.
I believe it's possible to continue using the old function, using the old ARN explicitly (though you might not be able to do this from the Lambda console.)
For more info, see http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html
It is now possible to have even more fine-grained control over how requests are handled between lambda function versions using the new traffic shifting feature announced recently at AWS's re:Invent conference:
https://aws.amazon.com/about-aws/whats-new/2017/11/aws-lambda-supports-traffic-shifting-and-phased-deployments-with-aws-codedeploy/

Can you send SNS push notification from lambda function in Amazon AWS?

I am developing an application with Amazon AWS and what I am trying to achieve is to attach a lambda function to DynamoDB table, so after a new row is added ,the lambda function is triggered.
In the above mentioned lambda function I want to add the functionality to send a push notification with Amazon SNS service, but I could not find any information in their documentation if that is possible and if it is, what exactly needs to be done to get it working? What I found in their documentation is that you can attach lambda function trigger to a SNS topic, which means that after a notification is pushed then the function is called, but what I am interested in is to send a push notification directly from lambda function. I would appreciate if someone shed some light on this topic for me.
Yes, you can call any of the API functions from Lambda. Perhaps if you posted some code and the errors you are getting you could get more specific help.