Skip to Content
Asterrr's Handbook
Service cheat sheets

Machine learning and generative AI

Securing Amazon Bedrock and SageMaker AI with IAM, KMS, PrivateLink, guardrails and logging, plus the status of Q and CodeGuru Security.

Generative AI security on the exam is ordinary AWS security applied to new resources. Control who can call a model, keep traffic private, encrypt customer data with KMS, filter prompts and responses, and log usage. Bedrock serves foundation models through an API. SageMaker AI trains and hosts your own models.

Customer VPCSame account and RegionInvokeModelPrivateLinkcustom model keyinvocation logsinvocation logsAPI callsApplication roleInterfaceendpointS3 log bucketCloudWatch LogsBedrock withguardrailKMS keyCloudTrail
A private Bedrock call. The VPC endpoint carries bedrock-runtime traffic. A guardrail filters input and output. Invocation logs go to S3 and CloudWatch Logs in the same account and Region.

Service table

ServiceWhat it isExam factSecurity controls
Amazon BedrockFoundation models behind one API, plus agents, knowledge bases, guardrails and model customizationModel providers have no access to the service-owned deployment accounts, so they see no prompts, completions or logsIAM and resource policies, TLS 1.2, KMS for custom models, agents and ingestion jobs, PrivateLink endpoints with policies, guardrails, invocation logging, CloudTrail
Amazon SageMaker AIBuild, train and host ML modelsContainers have internet access by default. Network isolation removes itExecution role, VPC config, EnableNetworkIsolation, KMS, optional inter-node encryption, CloudTrail, CVE-scanned prebuilt containers
Amazon Q BusinessEnterprise assistant over company dataNo longer open to new customers. AWS points to Amazon QuickPrivateLink endpoints, ACL Analyzer, IAM for administration
Amazon Q DeveloperCoding assistant that also scans code in the IDEIDE plugin support ends April 30, 2027. Console chat is now the AWS assistantAWS Builder ID sign-in in the IDE. Built on Bedrock with automated abuse detection
Amazon CodeGuru SecurityStatic code security scannerAWS ended support on November 20, 2025Not a current exam target. Do not pick it for new designs

Bedrock security

AreaWhat to remember
TransitTLS 1.2 or later. API and console use a secure connection
Encryption with KMSModel customization jobs and output custom models, agents, knowledge base data source ingestion jobs, OpenSearch Service vector stores, model evaluation jobs. Training, validation and output data in S3 use SSE-KMS. Third-party vector store credentials sit in Secrets Manager
Private accessInterface endpoints for bedrock, bedrock-runtime, bedrock-agent, bedrock-agent-runtime and bedrock-mantle. FIPS variants exist for bedrock and bedrock-runtime in some Regions
Endpoint policyDefault allows everything. Attach a custom policy to limit principals, actions such as bedrock:InvokeModel, and resources
Private DNSWith it on, the standard Regional hostname resolves to the endpoint and no code change is needed. With it off, call the vpce URL explicitly
Agent service roleTrust policy for bedrock.amazonaws.com with aws:SourceAccount and aws:SourceArn conditions. Needs model access, knowledge base Retrieve, and bedrock:ApplyGuardrail when a guardrail is attached
Action group LambdaNeeds a resource-based policy that lets the Bedrock service principal invoke it, scoped to the agent

Guardrails

A guardrail screens user input and model output. Use it in an inference call by passing the guardrail ID and version. Call ApplyGuardrail to screen text without invoking a Bedrock model, for example with a third-party model.

SafeguardPurpose
Content filtersHate, insults, sexual, violence, misconduct and prompt attack, with strength set per category
Denied topicsTopics your app must not discuss
Word filtersCustom words and phrases. Case-insensitive whole-word match
Sensitive information filtersBlock or mask PII and custom regex patterns
Contextual grounding checksDetect hallucinations, mainly in RAG answers
Automated Reasoning checksValidate answers against logical rules
  • A guardrail has a working draft and numbered versions. Applications use a version.
  • Guardrails do not check reasoning content blocks.
  • A role that only calls ApplyGuardrail needs bedrock:ApplyGuardrail on the guardrail ARN. It does not need InvokeModel.
  • Cross-account safeguards through guardrail enforcements exist for organization-wide control.

Invocation logging

  • It is off by default. When on, it records full request and response bodies and metadata for Converse, ConverseStream, InvokeModel and InvokeModelWithResponseStream.
  • Destinations are S3, CloudWatch Logs or both. The bucket or log group must be in the same account and Region.
  • Bodies over 100 KB, and binary data, go to S3 as separate objects.
  • Only calls through the bedrock-runtime endpoint are logged. Calls through bedrock-mantle are not.
  • S3 delivery needs a bucket policy for bedrock.amazonaws.com limited by source account and ARN. If the bucket uses SSE-KMS, the key policy must allow kms:GenerateDataKey for the service.
  • Each record includes the caller's identity.arn, so you can attribute usage to a role.

Exam signal

"Keep prompts off the public internet" is an interface VPC endpoint for bedrock-runtime. "Block PII in responses" is a guardrail sensitive information filter. "Audit exactly what users asked" is model invocation logging. It is the feature that records request and response bodies.

SageMaker AI security

ControlFact
Default at-rest encryptionSSE-S3 for Studio notebooks, notebook instances, model-building data, model artifacts and training, batch transform and processing output
Cross-accountSpecify your own customer managed KMS key. The default key cannot be shared across accounts
ContainersTraining and inference containers are internet-enabled by default
VPCSupply VpcConfig on training jobs, tuning jobs and models, then control egress with security groups and routes
Network isolationSet EnableNetworkIsolation to true. No outbound calls to any service, including S3, and no AWS credentials in the container. SageMaker still moves data using your execution role. Required for AWS Marketplace algorithms
Isolation with VPCS3 transfers go through your subnet, but the containers themselves still reach nothing
In transitTLS 1.2 across networks. Traffic between nodes in distributed training and processing is not encrypted by default. Inter-container encryption is optional and can slow training
Containers scannedPrebuilt SageMaker images and Marketplace listings are scanned for CVEs

Exam trap

Putting a training job in a VPC does not stop its code from sending data out if the subnet has a route to the internet. To guarantee no egress, use network isolation.

Legacy

Study notes that list Amazon CodeGuru Security or the Amazon Q Developer console chat as current describe retired or renamed products. Use the status shown in the table above.

GuardDuty AI Protection watches CloudTrail data events for Bedrock and SageMaker AI. Analytics covers querying invocation logs delivered to S3.

Further reading

On this page