Skip to content

SalmaMahfouz/FortuneTellerAWSLambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

FortuneTellerAWSLambda

A simple fortune teller app using AWS Lambda & AWS API GW Steps:

  1. Go to AWS Lambda: Choose "Author from Scratch" Give the funtion a name & choose Python 3.11 image
  2. Add the code in the Lambda Function: It is a simple function, that generates random numbers, and based on the random generated, an answer is given "yes, no, maybe" image
  3. Click deploy, then Test The test result should be something like the below: image by clicking on "Test" the message will keep chaning based on the random number generated.
  4. Then now we need to create the API
  5. Go to API Gateway service, and click on HTTP API
  6. Add the integration to be "Lambda" & choose the name of the function, set an API Name, then click next.
  7. Choose the method "GET"
  8. Go to "Routes", "Configure" to add a parameter.
  9. Mapping type will be "All incoming requests", parameter to modify will be "querystring.question", modification type "Append", value "$request.querystring.question" ^ "question" could be changed with whatever word.
  10. You need to take a note of this, because this what will we add in the Invoking URL: image
  11. go to APIs, click on the fortune teller API, there is no need to click deploy, because "auto deploy" was enabled when we created the API.
  12. Take the invoke URL, paste it in the browser, and add the following: /FortuneTellerApp?question="Should I go out today?" The invoke URL would be something like this: https://3rreln8oee.execute-api.us-east-1.amazonaws.com/dev so the full URL would be https://3rreln8oee.execute-api.us-east-1.amazonaws.com/dev/FortuneTellerApp?question="Should I go out today?"
  13. You will get an answer like the below: image By refershing , and changing the question, we should receive random answers to the question.

About

A simple fortune teller app using AWS Lambda & AWS API GW

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published