Lesson 1 of 3 Security, Compliance and Governance for AI

Securing AI Systems on AWS

This lesson explains how AI workloads are secured with the same AWS foundations as any other workload, plus controls for AI-specific threats such as prompt injection, data leakage and poisoning.

Learning outcomes

After completing this lesson, you will be able to:

  • Apply the shared responsibility model to AI workloads.
  • Explain how the Generative AI Security Scoping Matrix assigns security responsibilities.
  • Identify the core security controls for AI systems.
  • Identify the services that monitor and audit AI workloads, such as Bedrock model invocation logging.

Shared responsibility

The shared responsibility model applies to AI workloads just as to other AWS services. AWS secures the cloud itself: the infrastructure and the managed services, including the hosting of models in Bedrock. You secure what you do in the cloud: your data, who may call which models, the prompts you send, how outputs are used, and the configuration of your application. For example, AWS protects the servers that run a model, but you decide whether sensitive data may be included in prompts. The following table summarises the division.

AWS secures (security of the cloud)You secure (security in the cloud)
Infrastructure and managed services, including Bedrock model hostingYour data, access, prompts, application and configuration: who calls which models, what data you send and how outputs are used
Sort into groups

Whose responsibility?

Exam skills 5.1.1

A company runs an application on Amazon Bedrock. Decide who is responsible for each item.

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

The Generative AI Security Scoping Matrix

The matrix divides generative AI use cases into five scopes. Your security responsibilities grow from scope 1 to scope 5, so a ready-made application leaves you the least to secure and a self-trained model the most.

In scopes 1 and 2, you use an application someone else built: a public consumer application, such as a public chat app, or an enterprise application licensed for your organisation, such as Amazon Quick or Kiro. You mainly control what data your staff share with it. In scope 3, you build your own application on pre-trained models, for example by calling Bedrock, so you also secure the application and its prompts. In scope 4, you fine-tune a model on your data, so you also protect that training data and the customised model. In scope 5, you train a model from scratch and are responsible for everything, including the full training data set. The following table summarises the scopes.

ScopeUse caseExample
1Consumer applicationA public chat app
2Enterprise applicationAmazon Quick, Kiro
3Pre-trained models in your appYour app calling Bedrock
4Fine-tuned modelsYour customised model
5Self-trained modelsA model you trained from scratch

The following diagram shows how responsibility grows across the five scopes.

The Generative AI Security Scoping Matrix. Scopes 1 and 2 use applications someone else built, a consumer or an enterprise application, where you mainly control what data staff share. In scope 3 you build an application on pre-trained models and also secure it and its prompts. In scope 4 you fine-tune a model and also protect the training data and the customised model. In scope 5 you train a model from scratch and are responsible for everything.
The more you build, the more you secure.
Put in order

The five scopes

Exam skills 5.1.4 · 2.3.2

Put the five scopes of the Generative AI Security Scoping Matrix in order, from the least to the most security responsibility for you.

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

Core security controls

AI systems use the same core security controls as other workloads. For identity and access, IAM roles with least-privilege policies decide who can do what; for example, an application's role may be allowed to invoke only specific models, and permissions for training data, customisation and inference can be kept separate. For encryption, KMS keys protect training data, custom models and knowledge bases at rest, and TLS protects data in transit.

For the network, AWS PrivateLink provides private connections to Bedrock and SageMaker AI from a VPC, without the internet, and SageMaker can run in your VPC with network isolation. For sensitive data, Amazon Macie finds personal information in S3 training data so it can be masked or removed. For agents, AgentCore Identity manages credentials, AgentCore Policy sets the boundaries of their actions, and Guardrails checks their inputs and outputs. The following table summarises the controls.

ControlHow
Identity and accessIAM roles and least-privilege policies, e.g. an app's role may invoke only specific model IDs; separate permissions for training data, customisation and inference
EncryptionAWS KMS keys at rest (training data, custom models, knowledge bases); TLS in transit
NetworkAWS PrivateLink (interface VPC endpoints) to Bedrock and SageMaker AI; SageMaker in your VPC with network isolation
Sensitive dataAmazon Macie finds PII in S3 training data to mask or remove
AgentsAgentCore Identity for credentials; Policy in AgentCore for action boundaries; Guardrails for inputs and outputs
Match the pairs

Core controls

Exam skills 5.1.1

Match each security requirement with the control that meets it.

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

AI-specific threats and controls

AI systems also face threats of their own, each with matching controls. Prompt injection and jailbreaks are countered by the Guardrails prompt attack filter and by validating input. Data leakage, where a model reveals information it should not, is countered by personal-information filters, least-privilege access and never putting secrets in prompts. Toxic output is countered by content filters.

Model and data poisoning, where attackers corrupt training data or knowledge sources, is countered by using trusted, validated data sources with known lineage. Model theft or misuse is countered by access control and monitoring. Hallucinations are countered by grounding answers with RAG, contextual grounding checks, validating outputs and confidence scoring. The following table summarises the threats and controls.

ThreatControl
Prompt injection and jailbreaksGuardrails prompt attack filter, input validation
Data leakagePII filters, least privilege, no secrets in prompts
Toxic outputContent filters
Model and data poisoningTrusted, validated data sources with known lineage
Model theft or misuseAccess control and monitoring
HallucinationsRAG grounding, contextual grounding checks, output validation, confidence scoring

Monitoring and audit

Several services record what happens in AI workloads, for security monitoring and audits. Bedrock model invocation logging records the prompts sent to models and the responses returned, to CloudWatch Logs or S3, which lets you review how a model is being used. AWS CloudTrail records who called which API, such as who changed a guardrail. Amazon CloudWatch provides metrics, logs and alarms, for example on unusual usage, and Amazon Inspector finds vulnerabilities in the compute and code that run AI applications. The following table summarises the services.

ServiceRecords or detects
Bedrock model invocation loggingPrompts and responses, to CloudWatch Logs or S3
AWS CloudTrailWho called which API
Amazon CloudWatchMetrics, logs and alarms
Amazon InspectorVulnerabilities in compute and code
Scenario questions

Who did what?

Exam skills 5.1.1 · 5.2.2

Choose the service that provides each record.

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

Securing a Bedrock application end to end

A healthcare company builds an assistant on Bedrock. Its security review works through the layers the customer is responsible for:

LayerControl
Who can call which modelIAM policy allowing bedrock:InvokeModel only on the approved model ARN, for the application's role only
Network pathInterface VPC endpoint (PrivateLink) for Bedrock; no internet route from the application
Training and knowledge base dataMacie scan removed patient identifiers; S3 and the knowledge base encrypted with a KMS customer managed key
Inputs and outputsGuardrails: prompt attack filter, PII masking
AuditModel invocation logging to an encrypted S3 bucket; CloudTrail for API calls
VulnerabilitiesAmazon Inspector for the application's compute and container images
{
  "Effect": "Allow",
  "Action": ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream"],
  "Resource": ["arn:aws:bedrock:us-east-1:111122223333:inference-profile/us.amazon.nova-2-lite-v1:0",
               "arn:aws:bedrock:*::foundation-model/amazon.nova-2-lite-v1:0"]
}

Under the shared responsibility model, AWS secures the infrastructure and the model hosting; everything in this table is the customer's part.

Check yourself

When an application uses Amazon Bedrock, who is responsible for its data, prompts and access permissions?

Show answer

The customer, who controls the data, prompts, IAM permissions and application security. AWS secures the underlying infrastructure and the service.

Exam Tips

Remember for the exam

  • AWS secures the cloud infrastructure, and you secure your data, access and usage (the shared responsibility model).
  • To assign security duties by generative AI use case, use the Generative AI Security Scoping Matrix and its five scopes.
  • For private connectivity to Bedrock without the internet, use PrivateLink (an interface VPC endpoint).
  • To restrict which models an application can call, write an IAM policy on model IDs.
  • To find PII in training data in S3, use Amazon Macie.
  • For an audit trail of prompts and responses use model invocation logging; for API calls use CloudTrail.
  • To encrypt custom models and training data with your own keys, use AWS KMS.