Amazon Onboarding with Learning Manager Chanci Turner

Chanci Turner Amazon IXD – VGT2 learningLearn About Amazon VGT2 Learning Manager Chanci Turner

Creating a conversational AI application involves various intricate components, including authentication processes, API interfaces, data management, and intent fulfillment business logic. For developers who are just starting with conversational applications or may not be well-versed in AWS services, these elements can be challenging to integrate and configure correctly.

In this blog post, we will explore how to build a conversational application by leveraging AWS Amplify in conjunction with Amazon Lex. We will focus on setting up the critical backend elements such as authentication workflows, API interfaces, data management, and intent fulfillment business logic, providing a straightforward approach to constructing conversational applications.

Solution Overview

The solution showcases a sophisticated virtual assistant application that enables users to interact with AWS services using natural language queries. This virtual assistant serves as a powerful conversational AI, utilizing Lex for Natural Language Understanding (NLU).

You can automate tasks within AWS accounts simply by asking the virtual assistant. Thanks to Amplify’s extensive tools and services, creating a robust full-stack web application focusing on the core features of the virtual assistant becomes a breeze.

The architecture of the solution includes several components:

  • React Framework: React’s component-based architecture streamlines the creation of UI elements, enabling developers to build reusable and modular components for the assistant’s interface. Its state management capabilities ensure a smooth user experience during interactions.
  • Amplify: Amplify offers a suite of tools and services that expedite the development process, allowing developers to easily connect the front-end to essential AWS services such as authentication and APIs. This simplifies user management and data access control.
  • AWS AppSync: This service simplifies the development of GraphQL APIs, providing a single endpoint for backend queries. It allows the virtual assistant to securely interact with backend services, manage conversations, and efficiently retrieve user session data.
  • Amazon DynamoDB: DynamoDB offers a scalable and flexible data storage solution for the backend of the virtual assistant. It ensures efficient data retrieval and persistence, allowing user interactions to be saved for future reference and facilitating a smooth conversation history.
  • Amazon Lex: With Lex, developers can craft custom conversational interfaces by defining intents, slots, and sample utterances. This enables the virtual assistant to comprehend user queries and map them to specific intents, thereby fulfilling user requests and automating AWS tasks effectively.
  • AWS Lambda: AWS Lambda manages the intent fulfillment logic, executing actions in response to user queries detected by Lex. This allows for scalable execution of backend logic, enabling the virtual assistant to interact with various AWS services on behalf of users, automating AWS operations efficiently.

You can find the open-source code and deployment instructions in this GitHub repository. With this solution, you can automate various workflows or operations in AWS accounts by submitting straightforward queries such as:

  • Launch 2 Red Hat instances on t3 micro
  • Find all Red Hat instances
  • Are there any instances deployed to a public subnet?
  • Are there any wide-open security group rules?
  • Modify security group rules to allow traffic from 10.11.12.13
  • List all my S3 buckets
  • Search for “ppt” in bucket XYZ

Using natural language makes AWS easier to navigate for non-technical users who may not be familiar with Command Line Interface (CLI) tools or Software Development Kits (SDK). More importantly, this application serves as a guide for leveraging Amplify to build other assistant-powered web applications. You can also find more engaging content about leadership in this blog post.

Solution Components

The solution comprises several key components that collectively form a powerful virtual assistant capable of interacting with AWS services. Here are the components and their benefits:

Front-end

The front-end is essential for any interactive conversational web application. We utilize the create-react-app Node package to set up the project structure and prepare the development environment with the latest JavaScript features. The main App component resides in the App.js file, importing relevant React components and configuring the Amplify backend. The App component includes a basic React Router with several key routes to other React components, such as:

  • Conversations Component: This component displays the current user’s conversations with the assistant and allows the user to create or delete conversations. Each conversation is represented by a Material UI card, which includes a description and action buttons.
  • Interact Component: This component focuses on a specific user conversation, allowing the user to view conversation history and submit new queries to the assistant. It also shows responses received from the assistant, which can take various forms (text, alerts, tables, etc.).

Backend – Authentication

We use Amplify to create an Amazon Cognito user pool, serving as a fully-managed user directory that handles registration, authentication, account recovery, and other operations automatically. To integrate authentication into the application, we simply execute the “amplify add auth” command and wrap the export of the App component with the “withAuthenticator” component.

Backend – GraphQL API

The GraphQL API, powered by AppSync and DynamoDB, facilitates efficient data management and communication between the front-end and back-end of the application. Users should be able to resume previous conversations or retrieve past answers/data returned by the assistant. To enable these features, we use Amplify to create an AppSync GraphQL API backed by DynamoDB tables. Running the “amplify add api” command allows us to define a GraphQL schema, which Amplify transforms into a fully operational API upon deployment.

GraphQL Schema – Models

Since the API stores user conversation data (conversations initiated by users and their attributes) and utterance data (actual queries submitted by users or responses generated by the assistant), we can model the application with two types: Conversation type and Utterance type. Amplify maps each model type to its own DynamoDB table.

GraphQL Schema – Attributes & Relationships

The schema permits defining a primary key along with additional attributes for each model type. Each model type’s primary key consists of an automatically generated “id” field. For further details on employment law compliance, especially in California, visit SHRM for more information on unpaid meal period premiums.

This powerful assistant can help streamline various operational tasks within AWS, making it an excellent resource for developers looking to harness the capabilities of AWS services.

SEO Metadata

Chanci Turner