Trilogix Cloud

AI in AWS – a simple example using cloud native services

There are different varieties of AI.  Predictive AI has been deployed for some 7 years, using machine learning models and algorithms to help predict and forecast based on historical data sets.  Generative AI or Gen AI is different, using large language models (LLM) and heavier programming to go beyond simple forecasting into more process automation including document management and data life cycle management.  GenAI is best suited to the cloud and must be preceded by a data strategy, data normalisation and cleansing and a data architecture which supports AI automation.


In AWS we can build a simple application using GenAI, a powerful tool based on natural language processing and LLM. The application will allow us to upload a text file (for example, an email) from a web services endpoint (JSON doc, URL/URI) and generate a summary of its content.

Sample application architecture

Simple web application using AWS, Streamlit, Python, and Generative AI.

The application is a text summarization tool that can help get a summary of a long paragraph.

The architecture of the application is as follows:

The front-end is a web interface built with Streamlit, a Python library that allows you to create interactive web applications with minimal code. Streamlit is hosted on AWS ECS Fargate, a serverless compute engine that scales automatically based on demand.

-The back-end is a Generative AI service powered by Amazon Bedrock, a fully managed platform that provides access to pre-trained models for various natural language processing tasks.  Amazon Titan Text Generation 1 (G1) — Express model, can generate high-quality text from a given prompt or context.

The application also uses Langchain Bedrock LLM, a middleware layer that preprocesses the input text and passes it to Amazon Bedrock. Langchain Bedrock LLM is a natural language understanding module that can extract the main points, keywords, and sentiment from a text.

The deployment of the application is automated with Terraform, an infrastructure as code tool that allows you to define and provision cloud resources using a declarative language. Terraform creates the ECS Fargate cluster, the task definition, the service, and the security groups. You can also use an AWS Application Load Balancer to route the traffic to the ECS service and provide HTTPS encryption.

Leave a Comment

Your email address will not be published. Required fields are marked *