Lesson 4 of 5 Generative AI Concepts

Weighing AWS Infrastructure and Cost Trade-offs for Generative AI

This lesson explains how generative AI runs on specialised hardware and can be consumed in several ways, each with different costs and responsibilities, and the trade-offs behind choosing between AWS generative AI services.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify the advantages of building generative AI on AWS.
  • Distinguish AWS Trainium, AWS Inferentia and GPU instances.
  • Explain the trade-offs between responsiveness, availability, cost and other factors.

Advantages of using AWS for generative AI

Building generative AI on AWS offers several advantages. It is accessible: leading models are available through one API, so teams need no skills in running ML infrastructure. It gives speed to market, because managed features for RAG, agents and guardrails let a team build a working prototype in days. It is cost-effective, since you pay per token, or per hour of dedicated capacity, instead of buying GPUs.

It supports security and compliance, with private network connections, encryption with your own keys, data kept in the Regions you choose, and AWS's compliance programmes. And it offers choice: many providers and model sizes, so each use case can balance quality against cost. The following table summarises the advantages.

AdvantageWhat it means
Accessibility and lower barrier to entryLeading models through one API, with no ML infrastructure skills needed
Efficiency and speed to marketBuild prototypes in days with managed RAG, agents and guardrails
Cost-effectivenessPay per token, or per hour of dedicated capacity, instead of buying GPUs
Security and compliancePrivate connectivity, encryption with your keys, data kept in your chosen Regions, compliance programmes
ChoiceMany model providers and sizes, so you can match quality to cost
Match the pairs

Why build on AWS?

Exam skills 2.3.2

Match each statement with the advantage it describes.

Log in to try this activity Interactive activities are free with an account.

Specialised hardware

Training and running large models needs specialised processors, and AWS offers three kinds. AWS Trainium, in Trn instances, is AWS's own chip designed for training and fine-tuning models, at a lower cost than comparable GPUs. AWS Inferentia, in Inf instances, is designed for inference, running trained models with high throughput, low cost per prediction and lower energy use. NVIDIA GPU instances, in the P and G families, handle both training and inference and have the widest software support. The following table summarises the options.

HardwareDesigned forBenefit
AWS Trainium (Trn instances)Training and fine-tuning modelsLower training cost than comparable GPUs
AWS Inferentia (Inf instances)Running inferenceHigh throughput at low cost per inference and lower energy use
NVIDIA GPU instances (P and G families)Training and inference with the widest software supportFlexibility and performance

When you use Amazon Bedrock, AWS chooses and runs the hardware. Choosing hardware yourself only matters with SageMaker AI or self-managed EC2, ECS or EKS.

Trade-offs to weigh

Designing a generative AI solution means balancing several factors against each other. Responsiveness improves with smaller models and with provisioned capacity, which answer faster. Availability improves with cross-Region inference, which spreads requests across Regions for resilience and more throughput. Regional coverage limits choices, because not every model is offered in every Region and data residency rules may require a particular one.

Cost depends on the pricing model. With token-based pricing, cost grows with the length of prompts and answers and with model size. Provisioned Throughput gives predictable capacity and cost at a fixed hourly price, but is paid even when idle. Custom models add training and hosting costs, plus the work of keeping them current as better base models appear. The following table summarises the considerations.

FactorConsideration
Responsiveness (latency)Smaller models and provisioned capacity answer faster
Availability and redundancyCross-Region inference spreads requests across Regions for resilience and throughput
Regional coverageNot every model is offered in every Region; data residency may limit choices
Token-based pricingCost grows with prompt and answer length and with model size
Provisioned ThroughputPredictable capacity and cost at a fixed hourly price, paid even when idle
Custom modelsExtra training and hosting cost, and maintenance as base models improve
Scenario questions

Weighing the trade-offs

Exam skills 2.3.3 · 2.3.4

Choose the option that best meets each requirement.

Log in to try this activity Interactive activities are free with an account.
Worked example

Three ways to run the same model

A company wants a text-generation model for an internal assistant used by 2,000 staff. It compares three ways of running it:

OptionEffortCost patternFit
Bedrock on-demandLowest: call an APIPer token; nothing when idleBest for this variable, office-hours traffic
SageMaker AI endpoint with an open model from JumpStartMedium: choose instances, manage scalingPer instance-hour, even overnight unless scaled downWhen an open model must run in the company's own account
Self-managed on EC2 with InferentiaHighest: install, patch, scale, securePer instance-hour; cheapest per request only at very high, steady loadOnly with specialised needs and skills

The company chooses Bedrock on-demand. If usage later grew to millions of requests a day at a steady rate, Provisioned Throughput or a self-hosted model on Inferentia could become cheaper per request, at the price of more operational work.

Check yourself

What are AWS Trainium and AWS Inferentia designed for?

Show answer

Trainium chips are designed for training models and Inferentia chips for running inference, both at lower cost than general-purpose GPUs for suitable workloads.

Exam Tips

Remember for the exam

  • AWS generative AI services lower the barrier to entry and speed time to market.
  • Trainium is designed for training; Inferentia is designed for low-cost inference.
  • With Bedrock, AWS manages the hardware; with SageMaker AI or EC2, you choose it.
  • Cross-Region inference improves throughput and resilience.
  • Provisioned Throughput gives predictable capacity but is paid for even when idle.
  • Not every model is available in every Region.