Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Machine Learning Engineering on AWS
  • Table Of Contents Toc
Machine Learning Engineering on AWS

Machine Learning Engineering on AWS - Second Edition

By : Joshua Arvin Lat
4 (1)
close
close
Machine Learning Engineering on AWS

Machine Learning Engineering on AWS

4 (1)
By: Joshua Arvin Lat

Overview of this book

Modern AI systems increasingly leverage large language models, retrieval-augmented generation, and AI agents to power generative AI applications in the cloud. As organizations operationalize these systems at scale, there is a growing need for engineers with strong machine learning engineering expertise. To stay ahead in this rapidly evolving field, you need a deep understanding of AI and ML concepts as well as, practical, hands-on experience with the platforms and tools used to build and operate production-grade AI systems. Machine Learning Engineering on AWS is a practical guide that shows you how to use AWS services such as Amazon Bedrock and Amazon SageMaker AI to fine-tune, evaluate, and deploy LLMs and generative AI systems. You'll learn how to develop RAG-powered systems, build and deploy AI agents using Bedrock AgentCore and Strands Agents, evaluate models using LLM-as-a-judge techniques, and automate LLMOps pipelines using SageMaker Pipelines. The book also covers best practices for building scalable, secure, and production-ready GenAI systems. AWS AI hero Joshua Arvin Lat equips you with the skills and practical knowledge to handle a wide variety of ML engineering requirements, helping you design, operationalize, and secure generative AI systems and AI agents on AWS with confidence. *Email sign-up and proof of purchase required"
Table of Contents (12 chapters)
close
close
10
Other Books You May Enjoy
11
Index

Preface

A lot has changed since I wrote the first edition of this book. Back then, generative AI was still emerging, and most organizations were just starting to explore what large language models (LLMs) could do and how they would shift the way we build and think about machine learning workflows and pipelines compared to what we were used to. Since then, things have moved quickly. Today, generative AI has moved into production across many industries, with systems powered by LLMs, retrieval-augmented generation, and AI agents becoming an integral part of real-world applications. As you work with these systems, you will quickly realize that building them is no longer just about training and fine-tuning models. It now requires building and operating production-grade systems, automating LLMOps workflows, securing AI applications, and evaluating model, retrieval, and agent performance in real-world environments.

This shift has also created a clear demand for engineers who can combine machine learning expertise with practical cloud engineering skills to build and run these systems in production. Amazon Web Services (AWS) has also evolved significantly in this space. Using services such as Amazon Bedrock and Amazon SageMaker AI, you can now manage the end-to-end machine learning lifecycle more effectively, supported by AWS SDKs such as Boto3 and the SageMaker Python SDK V3.

In this second edition, I want to highlight the new approaches, solutions, and capabilities that are shaping how modern AI systems are built on AWS. As you go through the book, you will not just learn concepts. You will see how these ideas come together in practice through extensive hands-on work to build production-ready AI systems. We will start with the foundations of generative AI, LLMs, retrieval-augmented generation, and AI agents on AWS. From there, I will walk you through how to build AI agents using Bedrock AgentCore and Strands Agents, and explore machine learning engineering practices and workflows using Amazon SageMaker AI. As you move further into the book, you will work with modern data engineering and analytics patterns and practices on AWS, including managed transactional data lakes, practical data management, scalable data processing workflows, and feature store design. We will then go deeper into topics such as model training and fine-tuning, deployment strategies, model evaluation using LLM-as-a-judge techniques, and end-to-end LLMOps automation using SageMaker Pipelines and AWS Lambda. While you progress through the chapters, I will also highlight best practices and key considerations to help you design systems that are scalable, secure, and reliable in real-world environments.

When I wrote this second edition, my goal was simple. I wanted to help you bridge the gap between theory and real-world implementation. By the end of this book, you will have the understanding and hands-on experience needed to design, build, deploy, and operate modern AI systems on AWS with confidence.

Who this book is for

This book is for AI engineers, data scientists, machine learning engineers, and technology leaders who want to deepen their understanding of machine learning engineering, generative AI, large language models, retrieval-augmented generation, AI agents, and MLOps on AWS. A foundational understanding of artificial intelligence, machine learning, generative AI, and cloud engineering concepts is recommended.

What this book covers

Chapter 1, A Gentle Introduction to Generative AI and AI Agents on AWS, explores the fundamentals of generative AI on AWS and shows how to leverage various services and solutions to build AI agents. You will get started by working with foundation models provided through Amazon Bedrock, while also covering key concepts and terminology along the way. After setting up a SageMaker Studio space, you will build your first AI agent using Strands Agents, which interacts with a Bedrock model and is configured with tools to enhance its reasoning and problem-solving capabilities.

Chapter 2, Building AI Agents with SageMaker AI and Bedrock AgentCore, shows you how to build agents that interact with a SageMaker AI real-time inference endpoint. You will also learn how to use Amazon Bedrock Knowledge Bases and Amazon S3 Vectors to build retrieval-augmented generation powered agents that ground responses in external data. By using Strands Agents and Bedrock AgentCore, you will build agents that integrate model inference with external tools and knowledge retrieval capabilities to deliver more accurate and context-aware applications. You will explore how these building blocks work together to support flexible and production-ready agent-based systems.

Chapter 3, Machine Learning Engineering with Amazon SageMaker AI, covers the fundamentals of machine learning engineering on AWS, and shows you how to use Amazon SageMaker AI to implement end-to-end machine learning engineering workflows. You'll start by training and deploying an XGBoost model and then move on to fine-tuning a BERT model. Through these examples, you will learn how Amazon SageMaker AI simplifies the complexity of building and deploying different types of machine learning models by providing managed capabilities for training, inference, and model lifecycle management.

Chapter 4, Modernizing Analytics with a Managed Transactional Data Lake, shows you how to build and work with a transactional data lake using Amazon S3 tables. More specifically, you will learn how to create an Amazon S3 table bucket, launch an Amazon EMR cluster with Apache Iceberg, and run queries using Apache Spark. You will also practice running time travel queries on S3 tables to retrieve previous versions of your data and explore how datasets evolve over time.

Chapter 5, Practical Data Management on AWS, explores key AWS services and capabilities for supporting data management in modern analytics and machine learning workloads. You will learn how to work with AWS Lake Formation permissions, use Amazon Athena to query and process data stored in Amazon S3 table buckets, and ingest data into Amazon SageMaker Feature Store. You will also learn how to add searchable metadata to features and retrieve data from both the online and offline feature stores.

Chapter 6, Pragmatic Data Processing on AWS, shows you how to use SageMaker Processing jobs for running resource-intensive data processing scripts. You will start by running a simplified example to see how a SageMaker Processing job works. You will then download and prepare the input data and the processing.py script for the back-translation job to ensure that all prerequisites are in place. You will automate the back-translation process using SageMaker Processing by running your script on a machine learning instance managed by Amazon SageMaker AI. Along the way, you will also learn best practices for designing, managing, and scaling your data processing workflows efficiently and securely.

Chapter 7, SageMaker AI Model Training and Tuning Capabilities, explores how to fine-tune a LLM using Amazon SageMaker AI as part of an end-to-end machine learning workflow. You will set up a serverless MLflow application to track and manage training experiments, execute a supervised fine-tuning job, and observe how SageMaker AI abstracts the underlying infrastructure while automatically orchestrating the required compute resources. You will then perform hyperparameter tuning to systematically evaluate multiple configurations in parallel and identify the best-performing model based on a defined objective metric. Finally, you will deploy the best-performing model to a real-time inference endpoint for serving predictions.

Chapter 8, SageMaker AI Model Deployment Options and Strategies, explores different options and strategies for deploying models in Amazon SageMaker AI. You will work with a pretrained model and deploy it using a real-time endpoint, a serverless endpoint, an asynchronous inference endpoint, and a batch transform job. You will also practice advanced techniques such as shadow testing to validate a new model without affecting live traffic, and canary traffic shifting to gradually route a portion of production requests to a new model. Along the way, you will learn how to configure data capture to record inference requests and responses for monitoring and evaluation.

Chapter 9, Automating LLMOps Workflows with SageMaker Pipelines, shows you how to design and operationalize LLMOps pipelines using SageMaker Pipelines. You will begin with single-step pipelines for fine-tuning and evaluation and then extend this foundation into a multi-step pipeline, which will allow you to explore how individual stages can be composed into structured, automated workflows. As the pipeline evolves, you will introduce additional Lambda-based steps to load model artifacts, extract pipeline outputs, and orchestrate deployment logic. Finally, you will review key design principles and best practices for building production-grade machine learning workflows, with an emphasis on scalability, maintainability, security, and cost efficiency.

To get the most out of this book

You will need an AWS account and a stable internet connection to complete the hands-on exercises in this book. If you are using the digital version of the book, we recommend that you type the code yourself or access it from the book's GitHub repository. This will help you avoid potential errors caused by copying and pasting code.

Download the example code files

This book includes a complete downloadable code bundle containing all the example projects and files used throughout the chapters. We recommend downloading the bundle so you can follow along smoothly and experiment with the examples.

Use the bundle as a practical starting point. Modify it, extend it, and apply what you learn by creating your own variations as you progress through the chapters.

Get the code bundle

If you bought the book directly from Packt:

  1. Go to packtpub.com
  2. Click your profile picture and select Your Orders
  3. Find this book and click Download Code

If you bought this book from Amazon or any other channel partner:

  1. Go to packtpub.com/unlock or scan the following QR code:

    Image

  2. Search for this book
  3. Sign up or log in to your free Packt account
  4. Upload your proof of purchase and download the code bundle locally

Usage note: You're free to use and modify this code for personal learning and non-commercial projects.

Download the color images

Your purchase includes a color, DRM-free PDF copy of this book, ideal for viewing color images, screenshots, and diagrams. Refer to the Free benefits with your book section at the end of the Preface to unlock your PDF copy.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example: "Define the wait_for_endpoint() function that polls the endpoint status until it's in the InService state."

A block of code is set as follows:

trainer = SFTTrainer(
    model=model, 
    training_type=TrainingType.LORA, 
    model_package_group=model_package_group,
    training_dataset=dataset, 
    s3_output_path=output_path,
    accept_eula=True,
    mlflow_experiment_name=mlflow_experiment_name,
    mlflow_run_name=mlflow_run_name
)

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

from pipeline_wrapper import PipelineExecution
pipeline_execution = PipelineExecution(
    execution=execution
)

# Inspect the final step output(s)
pipeline_execution.outputs()

# Retrieve the CloudWatch logs for the first step
pipeline_execution.step(1).logs()

Any command-line input or output is written as follows:

python processing.py

Bold: Indicates a new term, an important word, or words that you see on the screen. For instance, words in menus or dialog boxes appear in the text like this. For example: "Open a new Launcher window by selecting File | New Launcher from the menu."

Warnings or important notes appear like this.

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book or have any general feedback, please email us at [email protected] and mention the book's title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you reported this to us. Please visit http://www.packt.com/submit-errata, click Submit Errata, and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit http://authors.packt.com/.

Share your thoughts

Once you've read Machine Learning Engineering on AWS, Second Edition, we'd love to hear your thoughts! Scan the QR code below to go straight to the Amazon review page for this book and share your feedback.

Image

https://packt.link/r/1835881092

Your review is important to us and the tech community and will help us make sure we're delivering excellent quality content.

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Machine Learning Engineering on AWS
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon