Hosting a Chatbot Program in AWS Lambda











up vote
1
down vote

favorite












I am a developer and new to the system engineering part, so still getting my concept clear.



I need to deploy my chatbot in Lambda and host it using API Gateway, but following conceptual problem is arising.



I have a chatbot built using simple AIML. I created it on python and its working properly.
For those who don't know of AIML, here I create an image of the AIML kernel : k = aiml.Kernel() and then as the conversation flow happens this kernel image is important for the conversation.



In my system, at an instance I just have one image of the kernel and things are good. But when I host this python program to Lambda and deploy it using API Gateway, for each request I will have a new image of the kernel, and my program will not function properly.



In a chatbot the conversation is happening at runtime, and and past conversation data is important, but if I am using API Gateway to trigger the Lambda function each time the user writes a new line, then every time a new image will be created of the kernel.



One option which I found was storing the user's session and conversation in a database. But in runtime if I am chatting, then the retrieval of past conversation and have the past conversation in the new image of kernel doesn't sounds a good way to go.



Or, even if we store the past conversation and send to the Lambda function using some JSON payload, then also since a new image of Kernel will be created by API Gateway, I have to run all the past conversation first and then only get the response for the new dialogue in the chat.



IN SHORT : How can I have one image of the kernel in the Lambda function, and get output using API Gateway, where the API is called multiple time for the same image of lambda function.



Or even if you know the general idea, how most online chatbots process and give responses, then that will also be very helpful.










share|improve this question
























  • Lambda won't be the correct tool here as it is stateless. What are the reasons you have chosen to use Lambda for your solution?
    – TenorFlyy
    2 hours ago










  • @TenorFlyy Chosen Lambda because I don't have to worry about other server issues and just needed this as a POC without worrying about the traffic, as only few request will happen in a day.
    – arqam
    2 hours ago










  • Why not just pack the BOT and put it inside an ECS container?
    – TenorFlyy
    2 hours ago










  • @TenorFlyy Is it compatible with AWS API Gateway, to get the response output as an API?
    – arqam
    2 hours ago










  • I think this is the easiest way to go: aws.amazon.com/blogs/compute/…
    – TenorFlyy
    2 hours ago















up vote
1
down vote

favorite












I am a developer and new to the system engineering part, so still getting my concept clear.



I need to deploy my chatbot in Lambda and host it using API Gateway, but following conceptual problem is arising.



I have a chatbot built using simple AIML. I created it on python and its working properly.
For those who don't know of AIML, here I create an image of the AIML kernel : k = aiml.Kernel() and then as the conversation flow happens this kernel image is important for the conversation.



In my system, at an instance I just have one image of the kernel and things are good. But when I host this python program to Lambda and deploy it using API Gateway, for each request I will have a new image of the kernel, and my program will not function properly.



In a chatbot the conversation is happening at runtime, and and past conversation data is important, but if I am using API Gateway to trigger the Lambda function each time the user writes a new line, then every time a new image will be created of the kernel.



One option which I found was storing the user's session and conversation in a database. But in runtime if I am chatting, then the retrieval of past conversation and have the past conversation in the new image of kernel doesn't sounds a good way to go.



Or, even if we store the past conversation and send to the Lambda function using some JSON payload, then also since a new image of Kernel will be created by API Gateway, I have to run all the past conversation first and then only get the response for the new dialogue in the chat.



IN SHORT : How can I have one image of the kernel in the Lambda function, and get output using API Gateway, where the API is called multiple time for the same image of lambda function.



Or even if you know the general idea, how most online chatbots process and give responses, then that will also be very helpful.










share|improve this question
























  • Lambda won't be the correct tool here as it is stateless. What are the reasons you have chosen to use Lambda for your solution?
    – TenorFlyy
    2 hours ago










  • @TenorFlyy Chosen Lambda because I don't have to worry about other server issues and just needed this as a POC without worrying about the traffic, as only few request will happen in a day.
    – arqam
    2 hours ago










  • Why not just pack the BOT and put it inside an ECS container?
    – TenorFlyy
    2 hours ago










  • @TenorFlyy Is it compatible with AWS API Gateway, to get the response output as an API?
    – arqam
    2 hours ago










  • I think this is the easiest way to go: aws.amazon.com/blogs/compute/…
    – TenorFlyy
    2 hours ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am a developer and new to the system engineering part, so still getting my concept clear.



I need to deploy my chatbot in Lambda and host it using API Gateway, but following conceptual problem is arising.



I have a chatbot built using simple AIML. I created it on python and its working properly.
For those who don't know of AIML, here I create an image of the AIML kernel : k = aiml.Kernel() and then as the conversation flow happens this kernel image is important for the conversation.



In my system, at an instance I just have one image of the kernel and things are good. But when I host this python program to Lambda and deploy it using API Gateway, for each request I will have a new image of the kernel, and my program will not function properly.



In a chatbot the conversation is happening at runtime, and and past conversation data is important, but if I am using API Gateway to trigger the Lambda function each time the user writes a new line, then every time a new image will be created of the kernel.



One option which I found was storing the user's session and conversation in a database. But in runtime if I am chatting, then the retrieval of past conversation and have the past conversation in the new image of kernel doesn't sounds a good way to go.



Or, even if we store the past conversation and send to the Lambda function using some JSON payload, then also since a new image of Kernel will be created by API Gateway, I have to run all the past conversation first and then only get the response for the new dialogue in the chat.



IN SHORT : How can I have one image of the kernel in the Lambda function, and get output using API Gateway, where the API is called multiple time for the same image of lambda function.



Or even if you know the general idea, how most online chatbots process and give responses, then that will also be very helpful.










share|improve this question















I am a developer and new to the system engineering part, so still getting my concept clear.



I need to deploy my chatbot in Lambda and host it using API Gateway, but following conceptual problem is arising.



I have a chatbot built using simple AIML. I created it on python and its working properly.
For those who don't know of AIML, here I create an image of the AIML kernel : k = aiml.Kernel() and then as the conversation flow happens this kernel image is important for the conversation.



In my system, at an instance I just have one image of the kernel and things are good. But when I host this python program to Lambda and deploy it using API Gateway, for each request I will have a new image of the kernel, and my program will not function properly.



In a chatbot the conversation is happening at runtime, and and past conversation data is important, but if I am using API Gateway to trigger the Lambda function each time the user writes a new line, then every time a new image will be created of the kernel.



One option which I found was storing the user's session and conversation in a database. But in runtime if I am chatting, then the retrieval of past conversation and have the past conversation in the new image of kernel doesn't sounds a good way to go.



Or, even if we store the past conversation and send to the Lambda function using some JSON payload, then also since a new image of Kernel will be created by API Gateway, I have to run all the past conversation first and then only get the response for the new dialogue in the chat.



IN SHORT : How can I have one image of the kernel in the Lambda function, and get output using API Gateway, where the API is called multiple time for the same image of lambda function.



Or even if you know the general idea, how most online chatbots process and give responses, then that will also be very helpful.







amazon-web-services aws-lambda






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago

























asked 4 hours ago









arqam

1,01321233




1,01321233












  • Lambda won't be the correct tool here as it is stateless. What are the reasons you have chosen to use Lambda for your solution?
    – TenorFlyy
    2 hours ago










  • @TenorFlyy Chosen Lambda because I don't have to worry about other server issues and just needed this as a POC without worrying about the traffic, as only few request will happen in a day.
    – arqam
    2 hours ago










  • Why not just pack the BOT and put it inside an ECS container?
    – TenorFlyy
    2 hours ago










  • @TenorFlyy Is it compatible with AWS API Gateway, to get the response output as an API?
    – arqam
    2 hours ago










  • I think this is the easiest way to go: aws.amazon.com/blogs/compute/…
    – TenorFlyy
    2 hours ago


















  • Lambda won't be the correct tool here as it is stateless. What are the reasons you have chosen to use Lambda for your solution?
    – TenorFlyy
    2 hours ago










  • @TenorFlyy Chosen Lambda because I don't have to worry about other server issues and just needed this as a POC without worrying about the traffic, as only few request will happen in a day.
    – arqam
    2 hours ago










  • Why not just pack the BOT and put it inside an ECS container?
    – TenorFlyy
    2 hours ago










  • @TenorFlyy Is it compatible with AWS API Gateway, to get the response output as an API?
    – arqam
    2 hours ago










  • I think this is the easiest way to go: aws.amazon.com/blogs/compute/…
    – TenorFlyy
    2 hours ago
















Lambda won't be the correct tool here as it is stateless. What are the reasons you have chosen to use Lambda for your solution?
– TenorFlyy
2 hours ago




Lambda won't be the correct tool here as it is stateless. What are the reasons you have chosen to use Lambda for your solution?
– TenorFlyy
2 hours ago












@TenorFlyy Chosen Lambda because I don't have to worry about other server issues and just needed this as a POC without worrying about the traffic, as only few request will happen in a day.
– arqam
2 hours ago




@TenorFlyy Chosen Lambda because I don't have to worry about other server issues and just needed this as a POC without worrying about the traffic, as only few request will happen in a day.
– arqam
2 hours ago












Why not just pack the BOT and put it inside an ECS container?
– TenorFlyy
2 hours ago




Why not just pack the BOT and put it inside an ECS container?
– TenorFlyy
2 hours ago












@TenorFlyy Is it compatible with AWS API Gateway, to get the response output as an API?
– arqam
2 hours ago




@TenorFlyy Is it compatible with AWS API Gateway, to get the response output as an API?
– arqam
2 hours ago












I think this is the easiest way to go: aws.amazon.com/blogs/compute/…
– TenorFlyy
2 hours ago




I think this is the easiest way to go: aws.amazon.com/blogs/compute/…
– TenorFlyy
2 hours ago

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203337%2fhosting-a-chatbot-program-in-aws-lambda%23new-answer', 'question_page');
}
);

Post as a guest





































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203337%2fhosting-a-chatbot-program-in-aws-lambda%23new-answer', 'question_page');
}
);

Post as a guest




















































































Popular posts from this blog

Schultheiß

Verwaltungsgliederung Dänemarks

Liste der Kulturdenkmale in Wilsdruff