awsimaya / DeploymentBot

A .NET based chatbot application using several AWS Services such as Lambda, Lex, Rekognition, CodePipeline and Polly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This application uses the following AWS services:

Application Design:

insert an image here

Follow these steps to create the application on your own

Step 1 - Create Code Pipeline

  • Follow this link to setup the pipeline which we will use later
  • Make sure you name the pipeline as MyFirstPipeline. If you name it something else, make sure you remember to make necessary changes to the Lambda function which we will create in future steps

Step 2 - Create the Lambda function

  • Create an IAM role called Lambda_DeploymentBot and assign the following policies to it

    • AWSLambdaFullAccess
    • AWSCodePipelineFullAccess
  • Clone this GitHub repo

  • Open DeploymentBotLambda.sln under DeploymentBotLambda folder using Visual Studio

  • Make sure the project compiles successfully

  • Right click on the project and select Publish to AWS Lambda...

  • Name the lambda DeploymentBotLambda and click Next

  • Select the role Lambda_DeploymentBot and click Upload which will publish the lambda to AWS

Step 3 - Create the Lex Bot

  • Go to Amazon Lex home page on your AWS Console
  • Click on the Create button and then click on Custom bot in the next screen
  • Name the bot as DeploymentBot and select None in the Output voice drop down.
  • Enter 5 for the timeout textbox
  • Choose Yes for COPPA and click Create
  • Create a slot and name it Environment. Add Alpha, Beta, Gamma, Production as values
  • Click on Create Intent button under the Editor tab and give it a name in the popup screen
  • Add the following utterances
    • Start Deployment
    • I want to start a deployment
  • Add the following slots
Name Slot Type Prompt
EnvironmentOption Environment Which environment do you want to deploy to? (Alpha, Beta, Gamma, Production)
DeploymentDate AMAZON.DATE What date do you want to schedule the deployment for?
DeploymentTime AMAZON.TIME What time do you want to schedule the deployment?
  • Uncheck the Confirmation Prompt checkbox if it is selected already
  • Select AWS Lambda function under Fulfillment, select DeploymentBotLambda in the Lambda function dropdown and select Latest for Version or alias dropdown
  • Now, Buld and then Publish the bot

Step 4 - Create the Chatbot WebApp

  • Create a Cognito Federated Identity Pool by following the below steps

    • From the AWS Console click Services.
    • Choose Services from the top menu bar and then search for "Cognito" and select it.
    • Choose Manage Identity Pools.
    • Choose Create New Identity Pool.
  • Configure the Pool for the app by following the below steps

    • Choose a name for your pool
    • Check the box that says Enable access to unauthenticated identities.
    • Hit the blue button that says Create Pool.
    • On the next screen, allow the default roles that AWS will create for you by clicking Allow.
    • Once the Amazon Cognito Federated Identity Pool has been created, Cognito will show sample code and the Pool ID. Copy the Pool ID and save it where you can easily retrieve it.
  • Open DeploymentBotWeb.sln under DeploymentBotWeb from the cloned folder

  • Set appropriate AWS credential values in Startup.cs

    Environment.SetEnvironmentVariable("AWS_ACCESS_KEY_ID", "<Your Amazon Access Key Id>");

    Environment.SetEnvironmentVariable("AWS_SECRET_ACCESS_KEY", "<Your Amazon Secret Access Key>");

    Environment.SetEnvironmentVariable("AWS_REGION", "<Your Region Name>");

  • Set appropriate values for the Lexbot under appsettings.json

    "AWSConfiguration": { "CognitoPoolID": "<Cognito Pool ID>", "LexBotName": "<Lex Bot Name>", "LexBotAlias": "<Lex Bot Alias>", "BotRegion": "<Your Region>" }

  • Build and run the Project

How to use the app

  • On the Login screen, upload a picture of Jeff Bezos
  • Amazon Rekognition will identify him and respond with a confirmation. Also, the application will make an audio confirmation using __Amazon Polly __
  • Click on the link that takes you to the Chat Page
  • Send a message saying Start Deployment
  • Continue answering questions from the chatbot
  • Once the chatbot has all the inputs, it will trigger the Codepipeline right away. Go to the Code Pipeline console to check the status of your deployment

About

A .NET based chatbot application using several AWS Services such as Lambda, Lex, Rekognition, CodePipeline and Polly


Languages

Language:C# 99.4%Language:CSS 0.5%Language:JavaScript 0.1%