Can we build Bot using AWS lex with out AWS Lambda Service - amazon-web-services

I am interested in building bot using AWS Lex but I don't want to use the AWS Lambda for interacting With DB for fetching results,
For Example. If we Ask, "Can you show me the sales for the last month" I want the bot to respond with an Answer " Sales for the last month $1.2 Million"; the Simplest way to achieve this to write an AWS Lambda function to get the details, but can we use an API Endpoint of a web app hosted on Ec2 Instance or AWS ELB
Any thoughts on this?
Surya

Unfortunately no, you cannot use any form of integration for a Lex bot without going through Lambda. You can build Lex bots without Lambda, but they are only able to give static responses and can't call outside of the Lex service.
You can still use your own API endpoint by going via Lambda. Remember that if the resource your calling is in an AWS VPC but not publicly available, you'll need to add extra config for the Lambda to access it. Example of config required for Lambda to call a private AWS endpoint can be see here: AWS: Lambda function cannot call rest api using private API of EC2 instance.
From the Lex FAQs:
Q. How is an action fulfilled?
Amazon Lex integrates with AWS Lambda for ‘fulfillment’ of the action
or business logic. Alternately, you can configure Amazon Lex to return
parsed intent and slot values to the client for action fulfillment.

Related

Can we implement AWS marketplace SaaS product without AWS Lambda?

For the AWS marketplace integration, we have checked the sample code of Serverless integration for SaaS products. The samples provided, it is based on AWS Lambda functions for registering new subscribers, subscribing to SQS etc.
Can we implement all these functionalities with our database, functions etc, instead of using AWS lambda and dynamo DB?
Also in the examples, some lambda functions are there like stream handler, entitlement-SQS, subscription-SQS-handler, grant-revoke-access-to-product etc. How can we trigger if we use our APIS?
Yes, the AWS Marketplace SaaS integration documentation states:
When a customer subscribes to your product, they are redirected to your registration URL which is an HTTP POST request with a temporary x-amzn-marketplace-token token.
All you need is an endpoint that can receive that POST in order to integrate. If you want to trigger any additional AWS API calls, your endpoint could make use of an AWS SDK. There are also requirements surrounding what your POST endpoint must do in order to be approved by the AWS Marketplace team. I suggest reviewing the documentation above or this AWS Marketplace
SaaS Listing Process & Integration Guide.

Invoke Lambda function on button click in React

To start I just want to say that I'm really new to AWS overall (1-2 weeks). So I might not think correct from start.
I'm working on an app where I want to click a button in JSX and trigger a Lambda function that gets data from a dynamodb table and shows it in the UI.
I'm writing the infrastructure as code using aws cdk. How should I face this? Do you have any guides that I can follow?
Welcome! Please have a look on this guide.
With AWS, it's a best practice to create an AWS API Gateway, which acts as your HTTP/HTTPS/API web server.
Within this API gateway, you can integrate a Lambda function with a route (e.g. GET /users), where that Lambda function grabs the data from AWS DynamoDB process it as you wish and returns the output.
To integrate it with your code, you create an HTTP GET/POST request to the API gateway URL.

Create an api in api gateway to invoke a lambda function

I am working on a project and trying to use API Gateway to invoke a lambda function. The lambda function is used to update a DynamoDB item. The DynamoDB table is used to keep a running count of visitors to a web page. I need to create an API to invoke the lambda function but I'm not sure how to create the API. Any assistance is appreciated.
General steps would be:
Create AWS_PROXY integration between API Gateway and your Lambda function. The example of this is in the AWS tutorials: Set up Lambda proxy integrations in API Gatewa and in Tutorial: Build a REST API with HTTP proxy integration
Add/amend execution role to your function allowing it to access DynamoDB. This is exemplified in the AWS tutorial: Using AWS Lambda with Amazon DynamoDB.
Test the API. It can be done directly in API gateway console, or using external tools such as curl or Postman.
I figured out my issue. In my lamdba function, I needed to change the output to a JSON object. Once I made the change, I was able to get my API working. Here is a link to the fix.

Creating AWS Lambda Triggers Programmatically

I have an AWS Lambda function that takes in and processes logs from CloudWatch Logs that are sent to specific log groups. The thing is, I may need to add more triggers as more log groups are created. The only way I have found to create a trigger for a specific log group is to use the AWS Lambda console and the AWS CloudFront console. Is it possible to create a trigger for an AWS Lambda function programmatically? For instance, in some Java code?
Yes, one of the common ways of triggering server-less functions is using endpoints. I believe you can expose an API endpoint from the Function's console using a an API Gateway, and call this endpoint URL from your java code or whatever programmatic entity you wish.

Can you create a test event for an AWS Lambda function via the AWS CLI?

In reviewing this URL from AWS I don't see any obvious way to add a "test event" programatically via the AWS CLI? Is there a way to do this?
https://docs.aws.amazon.com/cli/latest/reference/lambda/index.html
The Test capabilities presented in the AWS Lambda management console are a feature of the console itself, not the AWS Lambda service.
The Test feature provides the ability to define an incoming event record, then invoke the Lambda using that record.
You could do the same thing from an AWS CLI call, but you would need to provide the event to pass to the function.