Using Amazon Bedrock - Renaldi Gondosubroto - E-Book

Using Amazon Bedrock E-Book

Renaldi Gondosubroto

0,0
46,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

A from-scratch roadmap to building generative AI solutions on AWS with Amazon Bedrock

In Using Amazon Bedrock: Learn to Architect, Secure and Optimize Generative AI Applications on AWS, accomplished Software Engineer, developer advocate, and AWS Community Builder, Renaldi Gondosubroto, delivers an in-depth walkthrough of Amazon Bedrock, the keystone generative AI service on the Amazon Web Services cloud. Gondosubroto offers a start-to-finish guide of the service and its capabilities, from prompt engineering with foundational models to building applications using the API, working with multimodal models, and fine-tuning.

This book provides hands-on instruction on Amazon Bedrock from an experienced developer and AI specialist. It’s packed with real-world code samples, proven best practices, and techniques that result in reliable, secure, and cost-effective generative AI solutions. You’ll also find:

  • Demonstrations of robust governance guardrails and strategies for reducing development time
  • Repeatable, industry-grade frameworks for continuously iterating and optimizing models in production
  • Contemporary updates that incorporate the latest announcements made by Amazon at the re:Invent conference in December 2024 and beyond

Perfect for cloud architects, artificial intelligence engineers, and software engineers, Using Amazon Bedrock is an insightful, original, and practical roadmap to generative AI on AWS that explains the AI fundamentals you need to understand to get started in AWS generative AI development and the hands-on techniques you’ll use every day to transform those concepts into efficient, working solutions.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 726

Veröffentlichungsjahr: 2025

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Cover

Table of Contents

Title Page

Introduction

What Does This Book Cover?

Who Should Read This Book

Part 1: Introduction to Your New Generative AI Playground

CHAPTER 1: Introduction to Generative AI on AWS

The Current Generative AI Landscape

Tech Setup for Using Generative AI on AWS

Amazon Bedrock Capabilities

Summary

CHAPTER 2: Prompt Engineering with Foundational Models on AWS

Crafting Good Prompts

Learning About Zero-, One- and Few-Shot Inference

Configuring Your Bedrock Environment

Working with Parameters for Foundational Models

Experimenting with Playgrounds Provided by AWS

Practical Exercise: Finding the Right Prompt

Summary

Part 2: Core Generative AI on AWS

CHAPTER 3: Building Applications with the Amazon Bedrock API

Overview of Using the Amazon Bedrock API

Using Textual Models Through the API

Using Stable Diffusion for Image Generation

Maintaining Context in Generative AI Chatbots

Understanding the Requirements of a Generative AI Web App

Building Your First Generative AI Flask Application

Summary

CHAPTER 4: Working with Multimodal Foundational Models

Multimodal Foundational Models

Creating Prompts for Multimodal Foundational Models

Enhancing Context with Multimodal Foundational Models

Working with Amazon SageMaker JumpStart

Practical Exercise: Creating a Movie Recognizer

Summary

CHAPTER 5: Fine-Tuning Foundational Models on AWS

Fine-Tuning Foundational Models

Creating a Dataset for Fine-Tuning from Your Output

Fine-Tuning with Instruction on Bedrock

Fine-Tuning on Amazon SageMaker JumpStart

Summary

CHAPTER 6: Performing Retrieval-Augmented Generation on AWS

Retrieval-Augmented Generation

Fundamentals of RAG on AWS

Refining Embeddings for RAG Use in Vaccine Information Retrieval

Using Agents for Working with Foundational Models

Summary

CHAPTER 7: Optimizing Performance for Foundational Models

The Challenges of Compute and Memory with LLMs

Evaluation and Refining Performance of Foundational Models

Distributed Computing Approaches to Achieving Optimization

Optimizing Performance with Step Functions and Lambda

Achieving Consistency Between Deployments with CloudFormation

Summary

Part 3: Advancing the Building Blocks of Generative AI

CHAPTER 8: Security and Privacy for Deploying Generative AI Architectures on AWS

Security and Privacy for Generative AI Solutions

Integrating Access Control Management

Working with Guardrails for Bedrock

Automating Continuous Learning for Security and Privacy for LLMs

Summary

CHAPTER 9: Building End-to-End Applications with Generative AI

Planning for Organizational, End-to-End Projects with Generative AI

Leveraging the AWS Ecosystem in an End-to-End Solution

Creating an End-to-End Text-to-SQL System with Amazon Bedrock

Summary

CHAPTER 10: Sustainability and Scalability with Amazon Bedrock

The Path to Artificial General Intelligence

Automating Toward a Zero-ETL Future

Parallelizing Multiple Prompts with Batch Inference

Authenticity in the Age of Generative AI with Amazon Bedrock

An Optimistic Note for the Future of Generative AI on AWS

Summary

APPENDIX A: Configuring Your AWS Account

APPENDIX B: Installing Python, Jupyter Notebook, and LangChain

Installing Python

Installing Jupyter Notebook and LangChain

Installing the AWS Command-Line Interface (AWS CLI)

Next Steps: Configuring the AWS CLI

Index

Copyright

About the Author

About the Technical Editor

Acknowledgments

End User License Agreement

List of Tables

Chapter 2

Table 2-1: Different model configurations and their corresponding ...

Table 2-2: Definition and assessment of each element of the RACCCA...

Chapter 3

Table 3-1: A list of the API endpoints provided by AWS to use Amaz...

Table 3-2: Comparison of the two different modes, synchronous and ...

Table 3-3: A list of exceptions from Bedrock

Table 3-4: A list of the three different types of models provided ...

Chapter 4

Table 4-1: Titan vs. LLaVA

Table 4-2: Side-by-side prompt design examples

Table 4-3: Comparison of multimodal models

Chapter 5

Table 5-1: Datasets and their conversion needs

Table 5-2: Popular tools used in the fine-tuning exercise alongsid...

Chapter 6

Table 6-1: RAG vs. other approaches

Table 6-2: A comparison of vector databases

Table 6-3: A comparison of various embedding models

Chapter 7

Table 7-1: Nova vs. LLaVA* comparison

Table 7-2: Continuous vs. speculative batching

Table 7-3: Actions and rewards for reinforcement learning

Table 7-4: Key metrics for the model evaluation tasks

Chapter 8

Table 8-1: Emerging threats within the generative AI landscape

Table 8-2: A list of definitions for each component of the STRIDE ...

Table 8-3: Mitigations using STRIDE

Table 8-4: Common metrics and key questions used to gauge success...

Table 8-5: Common compliance and regulatory frameworks

Table 8-6: Common metrics and key questions used to gauge success...

List of Illustrations

Chapter 1

Figure 1-1: The seven phases of the life cycle of a generative AI...

Figure 1-2: Making an invocation to Amazon Bedrock through the

In

...

Figure 1-3: An example of a summarization workflow using Bedrock...

Figure 1-4: Workflow of querying from a fine-tuned model

Figure 1-5: A sample application created within the PartyRock env...

Figure 1-6: A simplified customer service chatbot architecture di...

Figure 1-7: Sample response based on a conversation buffer memory...

Chapter 2

Figure 2-1: An example of zero-shot inference in classifying inpu...

Figure 2-2: An example of few-shot inference, with examples to cl...

Figure 2-3: Getting access to the available models on Bedrock thr...

Figure 2-4: Testing that the Llama 3.3 70B Instruct model is work...

Figure 2-5: Running a prompt on the Bedrock chat playground

Figure 2-6: The model metrics that can be seen for the foundation...

Figure 2-7: An example of a PartyRock app

Figure 2-8: The Advanced Settings section of the output widget

Figure 2-9: Using the chat playground in Bedrock on the AWS Conso...

Figure 2-10: Sample run of the Claude Sonnet 4 model in the chat...

Chapter 3

Figure 3-1: Prompt for invoking the Amazon Bedrock API

Figure 3-2: Diagram of when to call each Bedrock endpoint

Figure 3-3: Sequence diagram illustrating the process of synchron...

Figure 3-4: API exception handling flowchart showing success and ...

Figure 3-5: A diagram of how the prompt is put through to Bedrock...

Figure 3-6: Using the image playground on Amazon Bedrock

Figure 3-7: A sample image of the futuristic city generated by ou...

Figure 3-8: An example of an in-memory chain from LangChain

Figure 3-9: Requirements for creating a generative AI web applica...

Figure 3-10: Sample diagram of how the food recommender chatbot ...

Figure 3-11: Using the Food Suggestion Chatbot by prompting the ...

Chapter 4

Figure 4-1: How multimodal models are prompted and return results...

Figure 4-2: Flow interaction between Titan Multimodal Embeddings ...

Figure 4-3: The initial image of the cityscape during the day bef...

Figure 4-4: The generated image for our prompt

Figure 4-5: The generated image for our new prompt

Figure 4-6: The image generated from inpainting

Figure 4-7: An illustration of the visual question answering work...

Figure 4-8: An illustration of the image captioning workflow

Figure 4-9: An image used to prompt for captioning it

Figure 4-10: A workflow for a question and answer diagram using ...

Figure 4-11: Workflow for getting the response displayed to the ...

Figure 4-12: The image rendered in Impressionist style

Figure 4-13: Workflow of querying a movie recognizer

Chapter 5

Figure 5-1: Fine-tuning workflow on a provisioned foundational mo...

Figure 5-2: Comparison of different generative AI deployment solu...

Figure 5-3: A flow of fine-tuning pretrained foundational models ...

Figure 5-4: Steps for setting up datasets for fine-tuning on Amaz...

Figure 5-5: Steps for creating the fine-tuning model based on Lla...

Figure 5-6: Viewing the fine-tuned models from the AWS Console

Figure 5-7: Querying an Amazon SageMaker endpoint

Figure 5-8: Configuring a training job with SageMaker Studio

Figure 5-9: Deploying the model to the endpoint with SageMaker St...

Chapter 6

Figure 6-1: An RAG flow interaction with Amazon Bedrock

Figure 6-2: A question-and-answer architecture diagram for intera...

Figure 6-3: The architecture stack of a RAG system

Figure 6-4: The RAG architecture of the flow of data with Amazon ...

Figure 6-5: Flow of RAG for providing response for vaccine questi...

Figure 6-6: Uploading files onto Amazon S3 for the knowledge base...

Figure 6-7: Creating a knowledge base on Amazon Bedrock

Figure 6-8: Creating an agent within Amazon Bedrock

Figure 6-9: Testing out the agent created for use in a customer s...

Chapter 7

Figure 7-1: Basic reinforcement learning loop where an agent inte...

Figure 7-2: A high-level look at the evaluation flow

Figure 7-3: Creating an automatic evaluation using the Amazon Bed...

Figure 7-4: Model evaluation interface for Bedrock

Figure 7-5: Specifying the job details for the Model Evaluation j...

Figure 7-6: Sample model evaluation report card after running the...

Figure 7-7: Sample load balancing for different nodes for complex...

Figure 7-8: Using Amazon Bedrock through AWS Step Functions

Figure 7-9: CloudFormation template deployment flow

Chapter 8

Figure 8-1: The five scopes of the Generative AI Security Scoping...

Figure 8-2: Potential weak points in generative AI deployments

Figure 8-3: Configuring the model invocation logging for Bedrock...

Figure 8-4: CloudWatch integration with Bedrock, which shows runt...

Figure 8-5: AWS CloudTrail being used to look at Bedrock recent e...

Figure 8-6: AWS GuardDuty being used for malware protection on an...

Figure 8-7: Amazon Macie being used for automated discovery of sen...

Figure 8-8: Amazon Inspector being used for getting a summary of ...

Figure 8-9: Accessing Bedrock's guardrails through the AWS Consol...

Figure 8-10: Adding a denied topic within a newly defined guardr...

Figure 8-11: Setting up the content filter for the guardrail on ...

Figure 8-12: Creating a guardrail for the Bedrock agent on the A...

Chapter 9

Figure 9-1: Workflow for developing customized generative AI fram...

Figure 9-2: Flow diagram for the end-to-end workflow for the Bedr...

Figure 9-3: A sample Amazon Bedrock-based end-to-end solution

Figure 9-4: Solution architecture for an end-to-end solution with...

Figure 9-5: Adding a policy to the S3 bucket to give the Lambda f...

Figure 9-6: Viewing the created target

athena_ingest_storage

tabl...

Figure 9-7: The new TextToSQL function viewed in the AWS Console...

Chapter 10

Figure 10-1: Capability classifications of the future goals of A...

Figure 10-2: Understanding increasing energy consumption and car...

Figure 10-3: A sample architecture of a Zero-ETL architecture fo...

Figure 10-4: Configuring the batch inference job for Amazon Bedr...

Figure 10-5: Watermark showing as detected for the AI-generated ...

Guide

Cover

Title Page

Copyright

About the Author

About the Technical Editor

Acknowledgments

Introduction

Table of Contents

Begin Reading

Appendix A: Configuring Your AWS Account

Appendix B: Installing Python, Jupyter Notebook, and LangChain

Index

End User License Agreement

Pages

i

xxi

xxii

xxiii

xxiv

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

ii

iii

iv

v

457

 

Using Amazon Bedrock

Learn to Architect, Secure and Optimize Generative AI Applications on AWS

 

Renaldi Gondosubroto

 

 

 

 

 

Introduction

Artificial intelligence has been promising to change the way we build software for decades, yet most teams still run into the same roadblocks: cost, complexity, and the sheer pace of research. Amazon Bedrock removes many of those roadblocks by placing a catalog of state-of-the-art foundational models behind a single, familiar AWS endpoint. What used to require specialized hardware and a PhD-level research team is suddenly available through the same console that developers already use for S3 or Lambda. That shift is why this book arrives today. Bedrock is new enough that patterns are not yet set in stone, but stable enough that projects started this quarter can ship to production and stay there.

The timing is critical. Businesses are eager to convert generative AI hype into production value, but proven patterns are still emerging. Documentation shows what the service can do; this book shows how to use it responsibly, why certain trade-offs matter, and where hidden costs or risks tend to lurk. You will progress from a simple prompt to a fully governed, production-ready workload without detouring into GPU management or in-depth research papers.

The book is organized into three parts that mirror the life cycle of a Bedrock-powered project:

Part 1

, “Introduction to Your New Generative AI Playground,” gives you the lay of the land, sets up local tooling, and shows how Bedrock fits alongside services like SageMaker and Lambda.

Part 2

, “Core Generative AI on AWS,” walks you through everyday tasks such as crafting effective prompts, calling the Bedrock API, fine-tuning models, and optimizing inference workloads.

Part 3

, “Advancing the Building Blocks of Generative AI,” tackles the concerns that surface once prototypes meet real users: security, privacy, orchestration, and the design of full-scale industrial solutions.

Each chapter pairs concise explanations with hands-on exercises you can complete on a personal AWS account. The goal is to turn concepts into muscle memory so that, by the final page, you can deploy large language models based on the AWS ecosystem into production with confidence.

Whether you plan to enrich a chatbot with company knowledge, autogenerate marketing copy in 20 languages, or orchestrate multimodal pipelines that classify images and draft compliance reports, Amazon Bedrock provides the building blocks. This book will show you how to assemble them. Let's get started.

What Does This Book Cover?

This book functions as a field guide that blends conceptual grounding with production-ready examples. Here are the core competencies you will develop as you progress through the chapters:

Install local tooling, provision a secure AWS environment, and understand where Bedrock sits alongside services such as SageMaker, Lambda, and Step Functions.

Move beyond one-line instructions to zero-, one-, and few-shot techniques; explore temperature and top-p tuning; and chain prompts to reduce hallucinations and control cost.

Invoke text, image, and multimodal models through the Bedrock API, integrate them with serverless or container workloads, and wrap them in user-facing web and mobile front-ends.

Fine-tune Titan, Claude, and other models; implement retrieval-augmented generation pipelines, and weigh trade-offs among data residency, latency, and total spend.

Apply least-privilege IAM, deploy guardrails, encrypt sensitive data, and align solutions with emerging AI-governance frameworks.

Benchmark memory and throughput, choose the right instance families, distribute inference across GPUs, and embed observability so you spot regressions before users do.

Explore zero-ETL data architectures, emerging large-context models, and the incremental steps organizations can take toward more autonomous systems.

Each core competency will ensure that you gain confidence in working with using Amazon Bedrock for your own workloads and tailoring it to your purpose.

Who Should Read This Book

This guide is aimed at anyone intent on building practical solutions with Amazon Bedrock. Readers tend to fall into one of the following groups:

AWS-savvy developers who have built REST or serverless backends but have yet to experiment seriously with generative AI. You know your way around IAM, CloudWatch, and CI/CD, yet crafting prompts or choosing which large language models to use still feels arcane. The code samples and exercises are designed to move you from curiosity to confidence.

Machine-learning engineers and data scientists who prototype models in notebooks now face the challenge of pushing those prototypes into production. You are fluent in fine-tuning and evaluation metrics, yet weary of managing GPU clusters. Bedrock's managed endpoints and this book's deployment patterns let you operationalize without babysitting hardware.

Cloud architects and DevOps practitioners charged with securing and scaling AI workloads. You are comfortable building VPCs, layering on guardrails, and keeping costs in check, but you need a repeatable way to integrate Bedrock into your existing estate. Reference architectures, IaC templates, and performance benchmarks keep the conversation grounded in real-world constraints.

Product managers, technical leaders, and forward-thinking executives who must translate buzzwords into roadmaps, budgets, and risk registers. While you may not copy every line of code, the decision matrices, cost models, and case studies will help you steer teams and communicate trade-offs to stakeholders.

Students, career-switchers, and tinkerers eager for a guided, project-based introduction. The structured hands-on exercises which include building chatbots, content pipelines, and multimodal dashboards ensure that you can graduate with a tangible portfolio.

For all readers, the learning curve can feel steep. Bedrock evolves quickly, official documentation is still catching up, and best practices often hide in scattered blog posts or conference talks. To spare you the scavenger hunt, every chapter highlights reputable sources such as documentation worth bookmarking.

There are several ways you can use this book. The most immersive route is to start at Chapter 1 and complete every hands-on exercise in sequence, assembling a fully-fledged AI solution by the end. Alternatively, you can cherry-pick chapters: grab the prompt-engineering walkthrough when you need it, jump ahead to the security chapter before an internal review, or use the performance-tuning section when cloud-cost alarms start ringing. To support both workflows, the companion GitHub repository provides templates and code snapshots for each major milestone, so you can drop in wherever you like without rebuilding from scratch.

However you approach it, the aim is the same: to bridge the gap between generative AI hype and production-grade implementations on Amazon Bedrock, arming you with the patterns, pitfalls, and vocabulary you need to deliver real value today.

How to Contact the Author

We appreciate your input and questions about this book! Email me at [email protected], or DM me on X at @Renaldig.

Part 1Introduction to Your New Generative AI Playground

Imagine a world where machines don't just process data; they create. Where a single prompt can generate a symphony of text, images, and ideas, all tailored to your needs. This isn't science fiction; it's the reality of generative AI, and it's transforming how we build, innovate, and solve problems. But with great power comes great complexity. How do you navigate this new frontier? Where do you even begin?

Welcome to your generative playground.

In Part 1, we'll lay the foundation for your journey into generative AI on AWS. Whether you're a curious developer or a seasoned architect, these chapters will equip you with the knowledge and tools to start building with confidence. We'll explore the current landscape of generative AI, break down the life cycle of a generative AI solution, and guide you through the technical setup required to get started. By the end of Part 1, you'll not only understand the “what” and “why” of generative AI, you'll also be ready to dive into the “how.”

Chapter 1 introduces you to the world of generative AI on AWS. We'll explore the current state of the technology, the life cycle of a generative AI solution, and the tools you'll need to get started. You'll also get a deep dive into Amazon SageMaker and Amazon Bedrock, the cornerstones of AWS's generative AI ecosystem. Chapter 2 takes you into the art and science of prompt engineering. You'll learn how to craft effective prompts, experiment with zero-shot, one-shot, and few-shot inference, and fine-tune parameters to get the most out of foundational models.

This is more than just an introduction—it's your launchpad. By the time you finish Part 1, you'll have the knowledge and tools to start building your own generative AI solutions. So, let's step into the playground and start creating. The future is waiting.