Lesson 1 of 3 Data Security and Privacy for GenAI

Building Protected Environments for Generative AI

This lesson covers network isolation, IAM, Lake Formation and monitoring that keep the traffic of generative AI applications private, encrypt data, restrict access to the minimum and record access for review.

Learning outcomes

After completing this lesson, you will be able to:

  • Isolate traffic with interface VPC endpoints and endpoint policies.
  • Restrict data access with IAM and Lake Formation.
  • Encrypt data with KMS and monitor access.

Network isolation with VPC endpoints

Interface VPC endpoints, powered by AWS PrivateLink, give applications in private subnets access to Amazon Bedrock (separate endpoints for the control plane, runtime, agents and agent runtime APIs), SageMaker AI APIs and runtime, and other services without an internet gateway or NAT device. Private DNS makes the standard endpoint names resolve to the private endpoint addresses, so SDK code does not change. Gateway endpoints provide private access to S3 and DynamoDB.

VPC endpoint policies restrict what can be done through an endpoint, for example only invoking approved models by principals in the organisation. SageMaker AI endpoints and jobs can run in a VPC, with network isolation for containers that should have no outbound access.

{
  "Statement": [{
    "Effect": "Allow",
    "Principal": "*",
    "Action": ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream"],
    "Resource": ["arn:aws:bedrock:*::foundation-model/amazon.nova-*",
                 "arn:aws:bedrock:*:111122223333:inference-profile/*"],
    "Condition": {"StringEquals": {"aws:PrincipalOrgID": "o-exampleorgid"}}
  }]
}

The following diagram shows the private network paths and the data restrictions.

A private RAG deployment. The application runs in private subnets with interface endpoints for Bedrock runtime and agent runtime and a gateway endpoint for S3, and endpoint policies allow only the application role. Lake Formation column-level permissions exclude name columns for the analytics agent's role, and customer managed KMS keys encrypt the knowledge base and logs.
Private DNS lets the SDK use the standard endpoint names.
Scenario questions

Private connectivity

Exam skills 3.2.1

Choose the network control for each private RAG requirement.

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

IAM data access patterns and Lake Formation

IAM policies enforce secure data access: roles for knowledge base ingestion read only their source prefixes, agent tool roles read only the tables they need, and the aws:SourceVpce or aws:SourceVpc conditions on bucket and IAM policies require access through private endpoints. Separate roles for ingestion, retrieval and administration support separation of duties.

AWS Lake Formation manages fine-grained permissions on data lake tables in the Glue Data Catalog: database, table, column, row and cell-level access, and tag-based access control with LF-tags. Services such as Athena and Glue enforce these permissions, so a text-to-SQL agent's role querying through Athena sees only permitted columns and rows, for example excluding salary columns or other regions' customers.

True or false

Controlling data access

Exam skills 3.2.1

Check three claims about controlling access to data used by GenAI applications.

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

Encryption and access monitoring

Data is encrypted at rest with AWS KMS: customer managed keys for knowledge bases, vector stores, S3 buckets, custom models, agent resources and logs give control over key policies, rotation and revocation, and every key use is logged in CloudTrail. TLS encrypts data in transit. CloudWatch and CloudTrail monitor access: alarms on unusual volumes of Retrieve or InvokeModel calls per principal, S3 data events for sensitive buckets, and metric filters for access denied errors. The following table summarises the controls.

ControlProtects
Interface VPC endpoints and endpoint policiesPrivate traffic; limits actions through the endpoint
IAM with source VPC endpoint conditionsAccess only from approved networks
Lake Formation column and row permissionsFine-grained data lake access for agents and analytics
KMS customer managed keysEncryption at rest with controlled key use
CloudWatch alarms and CloudTrailDetection of unusual access
Worked example

A private RAG deployment

A healthcare company requires that its RAG application have no internet path, that only its application role can invoke models, and that the analytics agent never sees patient names in data lake tables.

The application runs in private subnets with interface endpoints for Bedrock runtime and agent runtime and a gateway endpoint for S3; endpoint policies allow only the application role; Lake Formation column-level permissions exclude name columns for the agent's role; and KMS customer managed keys encrypt the knowledge base and logs.

Check yourself

Which condition key requires Bedrock calls to arrive through a specific VPC endpoint?

Show answer

aws:SourceVpce.

Exam Tips

Remember for the exam

  • Private access to Bedrock: interface VPC endpoints with endpoint policies.
  • Require private access: aws:SourceVpce conditions.
  • Column-level and row-level data lake access: Lake Formation.
  • Encrypt with KMS customer managed keys; monitor with CloudWatch and CloudTrail.