AI as a Service
Serverless machine learning with AWS
Peter Elger, Eóin Shanaghy
  • September 2020
  • ISBN 9781617296154
  • 328 pages
  • printed in black & white

A practical approach to real-life AI smartly based on a serverless approach. Enlightening!

Alain Couniot, Sopra Steria Benelux
Companies everywhere are moving everyday business processes over to the cloud, and AI is increasingly being given the reins in these tasks. As this massive digital transformation continues, the combination of serverless computing and AI promises to become the de facto standard for business-to-consumer platform development—and developers who can design, develop, implement, and maintain these systems will be in high demand! AI as a Service is a practical handbook to building and implementing serverless AI applications, without bogging you down with a lot of theory. Instead, you'll find easy-to-digest instruction and two complete hands-on serverless AI builds in this must-have guide!

About the Technology

Cloud-based AI services can automate a variety of labor intensive business tasks in areas such as customer service, data analysis, and financial reporting. The secret is taking advantage of pre-built tools like Amazon Rekognition for image analysis or AWS Comprehend for natural language processing. That way, there's no need to build expensive custom software. Artificial Intelligence (AI), a machine's ability to learn and make predictions based on patterns it identifies, is already being leveraged by businesses around the world in areas like targeted product recommendations, financial forecasting and resource planning, customer service chatbots, healthcare diagnostics, data security, and more.

With the exciting combination of serverless computing and AI, software developers now have enormous power to improve their businesses' existing systems and rapidly deploy new AI-enabled platforms. And to get on this fast-moving train, you don't have to invest loads of time and effort in becoming a data scientist or AI expert, thanks to cloud platforms and the readily available off-the-shelf cloud-based AI services!

About the book

AI as a Service is a fast-paced guide to harnessing the power of cloud-based solutions. You'll learn to build real-world apps—such as chatbots and text-to-speech services—by stitching together cloud components. Work your way from small projects to large data-intensive applications.
Table of Contents detailed table of contents

Part 1: First steps

1 A tale of two technologies

1.1 Cloud landscape

1.2 What is Serverless?

1.3 The need for speed

1.3.1 The early days

1.3.2 The Unix philosophy

1.3.3 Object orientation and patterns

1.3.4 Java, J2EE, .NET,

1.3.5 XML and SOAXML (Extensible Markup Language)SOA (service-oriented architecture)

1.3.6 Web speed

1.3.7 Cloud computing

1.3.8 Microservices (rediscovery)

1.3.9 Cloud native services

1.3.10 The trend: speed

1.4 What is AI?

1.4.1 History of AI

1.4.2 Real world AI

1.4.3 AI services

1.4.4 AI and machine learning

1.4.5 Deep learning

1.4.6 AI challenges

1.5 The democratization of compute power and artificial intelligence

1.6 Canonical AI as a Service architecture

1.6.1 Web application

1.6.2 Realtime services

1.6.3 Batch services

1.6.4 Communication services

1.6.5 Utility services

1.6.6 AI services

1.6.7 Data services

1.6.8 Operational support

1.6.9 Development support

1.6.10 Off-platform

1.7 Realization on Amazon Web Services

1.8 Summary

2 Building a serverless image recognition system, part 1

2.1 Our first system

2.2 Architecture

2.2.1 Web application

2.2.2 Synchronous services

2.2.3 Asynchronous services

2.2.4 Communication services

2.2.5 AI services

2.2.6 Data services

2.2.7 Development support and operational support

2.3 Getting ready

2.3.1 DNS domain and SSL/TLS certificate

2.3.2 Setup checklist

2.3.3 Get the code

2.3.4 Setting up cloud resources

2.4 Implementing the asynchronous services

2.4.1 Crawler service


3 Building a serverless image recognition system, part 2

3.1 Deploying the asynchronous services

3.1.1 Analysis service

3.2 Implementing the synchronous services

3.2.1 UI service

3.2.2 Front end service

3.3 Running the system

3.4 Removing the system


Part 2: Tools of the trade

4 Building and securing a web application the serverless way

4.1 The to-do list

4.2 Architecture

4.2.1 Web application

4.2.2 Synchronous services

4.2.3 Asynchronous services

4.2.4 Communication fabric

4.2.5 Utility services

4.2.6 AI services

4.2.7 Data services

4.2.8 Development support and operational support

4.3 Getting ready

4.3.1 Getting the code

4.4 Step 1: The basic application

4.4.1 Resources

4.4.2 To-do service

4.4.3 Front end

4.4.4 Deploying step 1

4.5 Step 2: Securing with Cognito

4.5.1 Getting the code

4.5.2 User service

4.5.3 To-do service

4.5.4 Front-end service

4.5.5 Deploying step 2


5 Adding AI interfaces to a web application

5.1 Step 3: Adding a speech-to-text interface

5.1.1 Getting the code

5.1.2 Note service

5.1.3 Front-end updates

5.1.4 Deploying step 3

5.1.5 Testing step 3

5.2 Step 4: Adding text-to-speech

5.2.1 Getting the code

5.2.2 Schedule service

5.2.3 Front-end updates

5.2.4 Deploying step 4

5.2.5 Testing step 4

5.3 Step 5: Adding a conversational chatbot interface

5.3.1 Getting the code

5.3.2 Creating the bot

5.3.3 Front-end updates

5.3.4 Deploying step 5

5.3.5 Testing step 5

5.4 Removing the system


6 How to be effective with AI as a Service

6.1 Addressing the new challenges of Serverless

6.1.1 Benefits and challenges of Serverless

6.1.2 A production-grade serverless template

6.2 Establishing a project structure

6.2.1 The source repository—​monorepo or polyrepo

6.2.2 Project folder structure

6.2.3 Get the code

6.3 Continuous deployment

6.3.1 Continuous deployment design

6.3.2 Implementing continuous deployment with AWS services

6.4 Observability and monitoring

6.5 Logs

6.5.1 Writing structured logs

6.5.2 Inspecting log output

6.5.3 Searching logs using CloudWatch Logs Insights

6.6 Monitoring service and application metrics

6.6.1 Service metrics

6.6.2 Application metrics

6.6.3 Using metrics to create alarms

6.7 Using traces to make sense of distributed applications

6.7.1 Enabling X-Ray tracing

6.7.2 Exploring traces and maps

6.7.3 Advanced tracing with annotations and custom metrics


7 Applying AI to existing platforms

7.1 Integration patterns for serverless AI

7.1.1 Pattern 1: Synchronous API

7.1.2 Pattern 2: Asynchronous API

7.1.3 Pattern 3: VPN Stream In

7.1.4 Pattern 4 VPN: Fully connected streaming

7.1.5 Which pattern?

7.2 Improving identity verification with Textract

7.2.1 Get the code

7.2.2 Text Analysis API

7.2.3 Client code

7.2.4 Deploy the API

7.2.5 Test the API

7.2.6 Remove the API

7.3 An AI-enabled data processing pipeline with Kinesis

7.3.1 Get the code

7.3.2 Deploying the API

7.4 On-the-fly translation with Translate

7.5 Testing the pipeline

7.6 Sentiment analysis with Comprehend

7.7 Training a custom document classifier

7.7.1 Create a training bucket

7.7.2 Upload training data

7.7.3 Create an IAM role

7.7.4 Run training

7.8 Using the custom classifier

7.9 Testing the pipeline end to end

7.10 Removing the pipeline

7.11 Benefits of automation


Part 3: Bringing it all together

8 Gathering data at scale for real-world AI

8.1 Scenario: Finding events and speakers

8.1.1 Identifying data required

8.1.2 Sources of data

8.1.3 Preparing data for training

8.2 Gathering data from the web

8.3 Introduction to web crawling

8.3.1 Typical web crawler process

8.3.2 Web crawler architecture

8.3.3 Serverless web crawler architecture

8.4 Implementing an item store

8.4.1 Getting the code

8.4.2 The item store bucket

8.4.3 Deploying the item store

8.5 Creating a frontier to store and manage URLs

8.5.1 Getting the code

8.5.2 The frontier URL database

8.5.3 Creating the frontier API

8.5.4 Deploying and testing the frontier

8.6 Building the fetcher to retrieve and parse web pages

8.6.1 Configuring and controlling a headless browser

8.6.2 Capturing page output

8.6.3 Fetching multiple pages

8.6.4 Deploying and testing the fetcher

8.7 Determining the crawl space in a strategy service

8.8 Orchestrating the crawler with a scheduler

8.8.1 Grabbing the code

8.8.2 Using Step Functions

8.8.3 Deploying and testing the scheduler


9 Extracting value from large data sets with AI

9.1 Using AI to extract significant information from web pages

9.1.1 Understanding the problem

9.1.2 Extending the architecture

9.2 Understanding Comprehend’s entity recognition APIs

9.3 Preparing data for information extraction

9.3.1 Getting the code

9.3.2 Creating an S3 event notification

9.3.3 Implementing the preparation handler

9.3.4 Adding resilience with a dead letter queue (DLQ)

9.3.5 Creating the DLQ and retry handler

9.3.6 Deploying and testing the preparation service

9.4 Managing throughput with text batches

9.4.1 Getting the code

9.4.2 Retrieving batches of text for extraction

9.5 Asynchronous named entity abstraction

9.5.1 Get the code

9.5.2 Starting an entity recognition job

9.6 Checking entity recognition progress

9.7 Deploying and testing batch entity recognition

9.8 Persisting recognition results

9.9 Tying it all together

9.9.1 Orchestrating entity extraction

9.9.2 End-to-end data extraction testing

9.9.3 Viewing conference data extraction results

9.10 Wrapping up



Appendix A: AWS account setup and configuration

A.1 Set up an AWS account

A.1.1 Providing your login credentials

A.1.2 Providing your payment details

A.1.3 Verifying your identity

A.1.4 Choosing your support plan

A.2 Signing in

A.3 Best practice

A.4 AWS Command Line Interface

A.4.1 Installing the AWS CLI on Linux

A.4.2 Installing the AWS CLI on MacOS

A.4.3 Installing the AWS CLI on other platforms

A.4.4 Configuring the local AWS environment

A.4.5 Checking the setup

Appendix B: Data requirements for AWS managed AI services

Appendix C: Data sources for AI applications

C.1 Public data sets

C.2 Software analytics and logs

C.3 Human data gathering

C.4 Device data

Appendix D: Setting up a DNS domain and certificate

D.1 Setting up a domain

D.1.1 Registering a domain name

D.1.2 Configuring your hosted zone

D.2 Settting up a certificate

D.2.1 Provisioning a new certificate

Appendix E: Serverless Framework under the hood

E.1 Walkthrough

E.2 Cleanup

What's inside

  • Apply cloud AI services to existing platforms
  • Design and build scalable data pipelines
  • Debug and troubleshoot AI services
  • Start fast with serverless templates

About the reader

For software developers familiar with cloud basics.

About the authors

Peter Elger and Eóin Shanaghy are founders and CEO/CTO of fourTheorem, a software solutions company providing expertise on architecture, DevOps, and machine learning.

placing your order...

Don't refresh or navigate away from the page.
print book $29.99 $49.99 pBook + eBook + liveBook
Additional shipping charges may apply
AI as a Service (print book) added to cart
continue shopping
go to cart

eBook $24.99 $39.99 3 formats + liveBook
AI as a Service (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks