Security, Compliance, and Governance for ML Workloads. This matters because your machine learning model is only as good as the data it uses, and if that data is stolen or misused, you face legal trouble and loss of trust. For the MLS-C01 exam, you need to know how AWS services protect your ML pipeline from unauthorised access, ensure you meet legal requirements, and keep everything organised and auditable.
Jump to a section
A simple way to picture Security, Compliance, and Governance for ML Workloads
Have you ever planned a party at your house and had to think about who gets in, what they can do, and what happens if something goes wrong?
That party is like an ML workload. You (the ML engineer) are the host. The guests are different users and services that need to interact with your models and data. Your house rules are the policies. Security is deciding who gets a key to the front door (authentication), and what rooms they can enter (authorisation). Compliance means following the local noise ordinance and not serving alcohol to minors — you must obey rules set by outside authorities, like GDPR or HIPAA. Governance is the overall plan: you write down who is allowed to change the playlist, you have a backup generator for the music system, and you schedule a cleaner for the next morning. Without these three things, your party could be chaos: a stranger drinks all your soda (data breach), the police fine you for noise (non-compliance penalty), and you have no record of who broke the lamp (no audit trail). In the cloud, AWS services like IAM (Identity and Access Management, the guest list), KMS (Key Management Service, the lockbox for your secret recipes), and CloudTrail (the CCTV footage) are the tools you use to run a successful, safe party.
When you build a machine learning solution on AWS, you are not just creating a smart program. You are building a system that handles data. Some of that data might be personally identifiable information (PII, like names, addresses, or medical records). Other data might be proprietary business secrets (like a secret recipe for a new product). Security, compliance, and governance are the three pillars that keep that data safe and the system running properly.
Let us break down each term.
Security means protecting your ML workload from unauthorised access and attacks. In a typical ML pipeline, data flows from a storage service like Amazon S3 (Simple Storage Service, a giant hard drive in the cloud) to a training service like Amazon SageMaker (a managed service for building and training models). Along the way, you need to encrypt the data — that is, scramble it so that only someone with the correct key can read it. Encryption at rest means the data is scrambled while stored on disk. Encryption in transit means the data is scrambled while it is being sent over the internet. AWS offers tools like AWS Key Management Service (KMS) to manage the encryption keys, and AWS Certificate Manager for SSL/TLS certificates (digital passports that prove a website is who it says it is).
Authentication is the process of verifying who someone is — typically with a username and password, or a more secure method like multi-factor authentication (MFA, where you need a password plus a code from your phone). Authorisation is deciding what that verified person is allowed to do. For example, a data scientist might be authorised to read the training data but not to delete it. AWS Identity and Access Management (IAM) is the core service for managing users, groups, roles, and permissions. An IAM role (a set of permissions that can be assumed by a service or user) is a common way to give Amazon SageMaker temporary access to your data in S3 without hardcoding passwords into your code.
Compliance means following external rules and standards. These rules come from governments (like GDPR in Europe or CCPA in California), industry bodies (like HIPAA for healthcare in the US, or PCI DSS for credit card data), or your own company policies. AWS provides compliance certifications for its services, which you can see in the AWS Artifact service (a self-service portal for compliance reports). For your ML workload, you must ensure that the services you use are compliant with the relevant frameworks. For example, if you handle medical data, you need to use AWS services that are HIPAA-eligible, and you must sign a Business Associate Addendum (BAA) with AWS. You also need to configure services correctly, like enabling encryption and logging.
Governance is the set of rules, policies, and processes you put in place to manage your ML workloads. It answers questions like: Who can deploy a model to production? How long do we keep training data? How do we track changes to a model? AWS services like AWS CloudTrail (a log of all API calls made in your account) and AWS Config (a service that records resource configurations and checks them against your rules) help you implement governance. For ML specifically, Amazon SageMaker provides features like SageMaker Studio (a web-based integrated development environment) with built-in governance tools, and SageMaker Model Registry (a catalogue of your trained models with versioning and approval workflows).
Why does this all matter for the MLS-C01 exam? Because the exam will test whether you know which AWS service to use for a given security or compliance scenario. You might be asked: 'A company needs to encrypt data at rest in Amazon S3 used for ML training. Which service manages the encryption keys?' The answer would be AWS KMS. Or: 'An ML team must track all changes to IAM policies for audit purposes. Which service should they enable?' The answer is AWS CloudTrail.
Let us walk through a typical secure ML pipeline.
Data Ingestion: Raw data arrives in an Amazon S3 bucket. The bucket has encryption enabled using AWS KMS. Access to the bucket is controlled by an IAM policy that only allows specific roles to read or write.
Data Preparation: A SageMaker Processing job reads the data. The job assumes an IAM role that has permission to decrypt the data using KMS. The data is processed and written to a new S3 bucket.
Model Training: A SageMaker Training job uses the prepared data. The training instance (a virtual server in the cloud, specifically an EC2 instance managed by SageMaker) uses a VPC (Virtual Private Cloud, a private network within AWS) to ensure network isolation. Data is encrypted in transit between S3 and SageMaker using HTTPS (a secure version of the web protocol).
Model Deployment: The trained model is deployed to a SageMaker endpoint (a live, managed API that serves predictions). The endpoint is also inside the VPC, protected by security groups (virtual firewalls) and network ACLs (Access Control Lists, rules that control inbound and outbound traffic at the subnet level). Only authorised applications can call the endpoint, verified by IAM credentials or a signed request.
Monitoring and Auditing: All API calls (e.g., creating a training job, updating an endpoint) are logged to CloudTrail. Amazon CloudWatch logs capture model performance and errors. Amazon Macie (a service that automatically discovers and protects sensitive data) can scan S3 buckets for PII.
Key services you must know for the exam:
AWS IAM: Users, groups, roles, policies. The foundation of all access control.
AWS KMS: Managed encryption keys. You can create, rotate, and disable keys.
AWS CloudTrail: Audit log of API calls. Essential for governance and forensic analysis.
AWS Config: Tracks configuration changes and checks compliance against rules.
Amazon Macie: Automated sensitive data discovery using machine learning.
AWS Secrets Manager: Securely stores and rotates secrets like database passwords and API keys.
Amazon GuardDuty: Threat detection service that monitors for malicious activity.
AWS Artifact: Self-service access to compliance reports and agreements.
Amazon SageMaker: The main ML service. Know its security features: VPC support, encryption at rest and in transit, IAM roles for jobs, and Model Registry with approval workflows.
Remember the principle of Least Privilege: give a user or service only the minimal permissions they need to do their job, nothing more. This is a core security concept that the exam loves to test. For example, if a SageMaker notebook instance only needs to read data from one specific S3 bucket, its IAM role should only allow read access to that bucket, not all buckets.
Finally, understand the Shared Responsibility Model: AWS is responsible for the security OF the cloud (the physical data centres, the networking hardware, the hypervisor), while you are responsible for security IN the cloud (your data, your IAM configurations, your encryption settings, your compliance obligations). For an ML workload, you are responsible for securing your data, your models, your API endpoints, and your code. AWS is responsible for ensuring that SageMaker, S3, KMS, and other services are themselves secure and compliant.
Identify data sensitivity and compliance requirements
Before building anything, determine what data you are handling (e.g., PII, medical, financial) and what regulations apply (GDPR, HIPAA, PCI DSS). This dictates which AWS services you must use (HIPAA-eligible) and what configurations (encryption type, logging) are mandatory.
Set up a secure AWS account foundation
Enable AWS CloudTrail for all regions to log every API call. Set up AWS Config with rules for compliance checks. Create IAM users and groups with least privilege policies. Enable multi-factor authentication (MFA) for the root user. This creates an audit trail and baseline security for all future ML work.
Create isolated data storage with encryption and access controls
Provision Amazon S3 buckets with server-side encryption (SSE-KMS recommended). Attach bucket policies that deny public access and restrict access to a specific VPC and IAM roles. Use AWS KMS with key policies that allow only specific IAM roles to encrypt/decrypt. This ensures data is protected at rest and only accessible by authorised services.
Configure a private network (VPC) for ML resources
Create a VPC with private subnets (no internet access). Set up VPC endpoints (Gateway or Interface) for S3 and SageMaker so that ML resources can access data and services without traversing the public internet. Define security groups and network ACLs to restrict inbound and outbound traffic. This isolates the ML pipeline from external threats.
Deploy SageMaker resources with IAM roles inside the VPC
Create IAM roles for SageMaker notebook instances, processing jobs, training jobs, and endpoints, each with minimal permissions (e.g., notebook role can only read from the raw S3 bucket). Launch these resources inside the private subnets of the VPC. Enable encryption in transit for SageMaker endpoints by requiring HTTPS. This ensures every part of the ML pipeline operates under least privilege and within a secure network.
Implement governance with Model Registry and continuous monitoring
Use SageMaker Model Registry to version models, capture metadata (training metrics, data sources), and require approval before a model is deployed. Set up CloudWatch alarms to monitor endpoint performance and detect anomalies. Enable Amazon Macie to automatically scan S3 buckets for sensitive data. Regularly review CloudTrail logs for suspicious activity. This creates a auditable, governance-controlled lifecycle for ML models.
You work as a machine learning engineer for a European healthcare startup. Your company has built a model that predicts patient readmission risks using medical records. This data includes PII (names, social insurance numbers) and medical history, so you must comply with GDPR (General Data Protection Regulation) and HIPAA (Health Insurance Portability and Accountability Act). Your job is to deploy this ML model securely. Here is exactly what you do.
First, you log into the AWS Management Console and create a new Amazon S3 bucket for the raw patient data. You immediately enable server-side encryption with AWS KMS (SSE-KMS). You create a new KMS key specifically for this project. You also configure an S3 bucket policy that denies all public access and only allows access from a specific VPC (Virtual Private Cloud). This ensures the data cannot be accessed from the public internet.
Next, you set up AWS IAM roles. You create a role called 'SageMakerHealthcareRole' that has permissions to read from that S3 bucket, use the KMS key for decryption, and write to another S3 bucket for processed data. You also attach a policy that allows logging to CloudWatch. You then create a user for the data scientist on your team with very limited permissions: she can only start SageMaker notebook instances in a specific VPC and cannot delete any resources.
You then create a SageMaker notebook instance inside the VPC you set up earlier. The notebook instance assumes the IAM role you created. The instance uses a security group (virtual firewall) that only allows inbound SSH (secure shell) access from the company VPN (Virtual Private Network, an encrypted tunnel into the corporate network). This means the data scientist can only access the notebook from within the office network.
Now you prepare the data using a SageMaker Processing job. You write a script that anonymises the data by removing direct identifiers (names, IDs) and replaces them with pseudonyms. The job runs inside the VPC, uses the same IAM role, and logs all steps to CloudWatch. After processing, the anonymised data is stored in a separate S3 bucket with its own KMS key.
For model training, you use a SageMaker Training job. You configure it to use a spot instance (discounted, unused EC2 compute capacity) to save costs, but you also ensure that training resumes from the last checkpoint if the instance is interrupted. The training data is pulled from the processed data bucket, encrypted in transit using HTTPS. The resulting model artifact is saved to an S3 bucket with encryption enabled.
To deploy, you create a SageMaker endpoint configuration that specifies the model, the instance type (e.g., ml.m5.large), and the initial instance count. You set the endpoint to be private inside the VPC, so it can only be called from within your corporate network. You then create a VPC endpoint for Amazon API Gateway (a service for creating and managing APIs) so that your healthcare app can securely invoke the endpoint without traversing the internet.
Finally, you enable AWS CloudTrail (if not already enabled) and AWS Config to monitor all changes. You create a Config rule that checks whether S3 buckets have encryption enabled and whether IAM roles have the principle of least privilege. You also set up Amazon Macie to scan the data buckets for any accidental exposure of PII.
To ensure compliance, you download the AWS Artifact report for HIPAA and GDPR to verify that all services you are using are covered. You sign a Business Associate Addendum (BAA) with AWS. You also set up a monthly audit where you review CloudTrail logs for suspicious activity and regenerate IAM access keys if needed.
What does an IT professional actually do in this scenario? They orchestrate all these AWS services correctly, write the IAM policies, manage encryption keys, monitor logs, and constantly check that the system remains compliant as regulations change. They also educate the team, like teaching the data scientist not to hardcode passwords into her notebook code (she should use IAM roles instead). - They spend time writing infrastructure as code (using AWS CloudFormation or Terraform) to define all these resources as scripts, so the entire secure environment can be recreated automatically. - They set up automated notifications (via Amazon SNS, Simple Notification Service) if a Config rule detects a non-compliant resource. - They perform penetration testing (authorised simulated attacks) on the endpoint to test its security, with prior approval from AWS. - They manage key rotation for KMS keys on a schedule (e.g., every 90 days).
The biggest challenge is balancing security with usability. If you lock everything down too tightly, the data scientists cannot work efficiently. The IT pro must design a system that is both secure and flexible, using features like IAM roles for cross-account access (if the data is in another AWS account) and VPC peering (connecting two VPCs together privately) when needed.
The MLS-C01 exam dedicates significant content to security, compliance, and governance in the context of ML. The questions are scenario-based, meaning they describe a business problem and ask you to choose the correct AWS service or configuration. You will not be asked to write code, but you must know which service does what.
Here are the exact concepts they love to test.
Data encryption at rest and in transit: You must know the difference between SSE-S3, SSE-KMS, and SSE-C for S3. SSE-S3 is Amazon's default encryption with keys managed by AWS. SSE-KMS uses your own keys managed by KMS, giving you more control (e.g., key rotation, separate permissions for key use). SSE-C means you provide your own encryption key, and AWS manages the encryption but forgets the key after use. For exam scenarios, SSE-KMS is usually the best answer if the question mentions key management control or compliance requirements.
IAM roles for SageMaker: The exam will ask: 'How should a SageMaker notebook instance access data in S3?' The correct answer is 'Create an IAM role and attach it to the notebook instance.' It will never suggest storing AWS access keys in the notebook. Remember that principle of least privilege: the role should only have permissions necessary for the specific task.
VPC configuration for SageMaker: Questions often describe a company that requires its ML training to happen in a private subnet with no internet access. The correct answer involves creating a VPC-only endpoint (a gateway endpoint for S3 or an interface endpoint for other services) so that SageMaker can access data without going through the public internet. They may also test VPC flow logs (records of network traffic in the VPC) for monitoring.
AWS CloudTrail vs. AWS Config: This is a classic trap. CloudTrail records who did what, when, and from where — it is an audit log of API calls. AWS Config records the state of your resources over time and checks them against rules — it is about compliance and configuration drift. For example, if a question says 'You need to track when an IAM role was modified and by whom', use CloudTrail. If it says 'You need to detect if an S3 bucket has become publicly accessible', use AWS Config.
Amazon Macie vs. Amazon GuardDuty: Macie is specifically for discovering and protecting sensitive data (PII, financial data) in S3. GuardDuty is a threat detection service that monitors for malicious activity across your account, like unusual API calls or compromised EC2 instances. The exam might present a scenario where a company fears credit card numbers have leaked into a data lake — use Macie. For a scenario about an EC2 instance that may be doing something suspicious (like mining cryptocurrency), use GuardDuty.
AWS Artifact and BAA: You will be asked about compliance documentation. AWS Artifact is the place to download SOC reports, PCI reports, and ISO certifications. A Business Associate Addendum (BAA) is the contract you need to sign with AWS if you handle protected health information (PHI) for HIPAA compliance. Knowing when to use Artifact vs. just enabling KMS is key.
Amazon SageMaker Model Registry: This is a governance feature. It allows you to version models, add metadata (like training metrics or approval status), and set up an approval workflow before a model goes to production. The exam may ask: 'How do you enforce that only approved models are deployed?' The answer is SageMaker Model Registry with a manual approval stage.
AWS Secrets Manager vs. AWS Systems Manager Parameter Store: Both store secrets, but Secrets Manager is designed specifically for automatic rotation of secrets (like database passwords) and has a higher cost. Parameter Store is simpler and can store plain text or encrypted strings. For exam scenarios involving automatic password rotation, choose Secrets Manager.
Trap patterns to watch for:
KMS key policies vs. IAM policies: They test whether you understand that KMS keys have their own resource-based policies in addition to IAM policies. A common wrong answer is to only attach an IAM policy without updating the KMS key policy. The correct approach is to ensure both allow the access needed.
Cross-account access: For scenarios where an ML team in one account needs to access data in another account, the correct solution is to use an IAM role in the data account with a trust policy that allows the ML team's account to assume that role, plus a KMS key policy that allows the role to use the key. A trap answer might be to share the S3 bucket access keys directly or to make the bucket public.
Endpoint security: A common question says: 'Your SageMaker endpoint must only be accessible from your corporate VPN.' The correct answer is to deploy the endpoint inside a private subnet in your VPC and set up a VPC endpoint for the endpoint to be invoked privately. An incorrect answer might suggest using an API gateway with a public endpoint and using IAM auth alone — but that still allows internet traffic.
Key definitions to memorise:
Encryption at rest: Data stored on disk is encrypted.
Encryption in transit: Data moving across the network is encrypted.
Principle of least privilege: Every user and service gets only the minimum permissions needed to function.
Shared Responsibility Model: AWS secures the cloud; you secure what you put in the cloud.
IAM role: A set of permissions that can be assumed by AWS services or users for temporary access.
VPC: A virtual network you create in the cloud, isolated from other AWS customers.
Security group: A stateful virtual firewall that controls traffic to/from individual resources (like EC2 instances or SageMaker endpoints).
Network ACL: A stateless firewall that controls traffic in and out of entire subnets.
The exam will present four answer choices, and at least two will be plausible but incorrect. Often, the wrong choice uses a service that does exist but for a different purpose (e.g., using CloudTrail when they wanted Config). Another pattern is using the correct service but with the wrong configuration (e.g., SSE-S3 when the question requires customer-managed keys). Always read the question carefully for keywords like 'customer controlled key rotation' (use SSE-KMS) or 'audit trail of management events' (use CloudTrail).
Security in ML on AWS relies on the Shared Responsibility Model: AWS secures the cloud infrastructure, you secure your data, IAM policies, encryption, and compliance.
Always use IAM roles instead of long-term access keys when a service (like SageMaker) needs to access another AWS resource like S3.
Encryption at rest in S3 can be SSE-S3 (AWS-managed keys), SSE-KMS (customer-managed keys via KMS), or SSE-C (customer-provided keys); SSE-KMS gives you the most control and auditability.
AWS CloudTrail records API calls for auditing and forensic analysis, while AWS Config tracks resource configuration drifts and compliance rules.
Amazon Macie discovers and protects sensitive data (like PII) in S3, whereas Amazon GuardDuty detects broader security threats across your AWS account.
For HIPAA compliance, you must use only HIPAA-eligible AWS services and sign a Business Associate Addendum (BAA) with AWS, which can be accessed through AWS Artifact.
SageMaker Model Registry enforces governance by allowing versioning, metadata capture, and approval workflows before models are deployed to production.
The principle of least privilege means granting only the minimum permissions necessary for a user or service to perform its task, reducing the blast radius of a security incident.
These come up on the exam all the time. Here's how to tell them apart.
AWS CloudTrail
Records every API call made in your AWS account.
Used for security auditing and forensic investigations.
Provides a timeline of who did what, when, and from where.
AWS Config
Records the current and historical configuration of your AWS resources.
Used for compliance checks and detecting configuration drift.
Evaluates resources against rules (e.g., 'S3 bucket must be encrypted').
Amazon Macie
Automatically discovers and protects sensitive data (PII, financial credentials) in S3.
Uses machine learning to classify data and alert on exposure.
For compliance with data privacy regulations like GDPR.
Amazon GuardDuty
Threat detection service that monitors for suspicious activity across your account.
Analyses VPC flow logs, CloudTrail events, and DNS logs.
Detects compromised instances, crypto mining, and unusual API calls.
SSE-KMS
You manage the encryption keys via AWS KMS.
Allows separate permissions for key use, key rotation policies, and audit trails.
Suitable for compliance scenarios requiring customer-controlled key management.
SSE-S3
Amazon manages the encryption keys automatically.
No customer control over key rotation or access logging.
Simpler and less expensive, but less control.
IAM User
Has long-term credentials (password and access keys).
Used by humans or applications that need persistent access.
You must manually rotate passwords/access keys periodically.
IAM Role
Provides temporary credentials (valid for up to 12 hours).
Used by AWS services or federated users who need short-lived access.
Automatically revokes credentials when the role session ends.
Security Group
Stateful firewall: if you allow inbound traffic, the response is automatically allowed.
Operates at the instance or resource level (like a SageMaker endpoint).
You specify allow rules only; deny rules are implicit.
Network ACL (NACL)
Stateless firewall: inbound and outbound rules are evaluated independently.
Operates at the subnet level (affects all instances in the subnet).
You specify both allow and deny rules explicitly.
Mistake
If I use AWS managed services like SageMaker, I don't need to worry about security because AWS handles everything.
Correct
AWS secures the underlying infrastructure, but you are responsible for your data, your IAM permissions, your encryption settings, and your compliance obligations. This is the Shared Responsibility Model.
Beginners hear 'managed service' and assume it means 'fully managed' for security too. They do not realise that managed services still require the customer to configure access controls and encryption.
Mistake
Encryption in transit is automatically enabled for all AWS services.
Correct
Many AWS services require you to explicitly enable encryption in transit (e.g., enabling HTTPS on a SageMaker endpoint, or using a VPC endpoint instead of a public endpoint). Default configurations often use unencrypted HTTP for some traffic.
AWS documentation highlights that many services have secure defaults, but not all. Beginners assume 'cloud' automatically means 'secure everywhere'.
Mistake
Using an IAM role is only for human users, not for services like SageMaker.
Correct
IAM roles are often used for services (like SageMaker training jobs) to give them temporary, limited permissions without embedding any credentials in the code. Services 'assume' a role just like a user would.
The term 'role' sounds like something a person would use. Beginners do not understand that AWS services themselves can act as trusted entities that assume roles.
Mistake
If I encrypt my data at rest using SSE-S3, I have full control over who can decrypt it.
Correct
With SSE-S3, Amazon manages the encryption keys entirely. You have no control over key rotation or who can use the keys. SSE-KMS gives you that control via key policies and audit trails.
People think encryption equals control, but the type of key management determines how much control you actually have.
Mistake
AWS Config is the same as AWS CloudTrail, just a different dashboard.
Correct
CloudTrail records API events (who did what and when). AWS Config records resource configuration changes and evaluates them against rules. They are complementary but distinct services.
Both deal with 'tracking' things, so beginners conflate them. The exam specifically tests the distinction.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
CloudTrail records API activity (who called what, when, from where) for security auditing. AWS Config records the state of your AWS resources and evaluates them against compliance rules (e.g., 'is this S3 bucket public?'). CloudTrail is for who did what; Config is for what the resources currently look like.
Yes, especially if your data is sensitive. By default, SageMaker uses HTTPS for communications with S3, but you should explicitly verify that your VPC endpoint for S3 uses a policy that enforces encryption in transit. You can also use a VPC interface endpoint with encryption.
A BAA is a legally binding contract you sign with AWS if you handle protected health information (PHI) under HIPAA. It states that AWS will protect your data as required by HIPAA. You can get the BAA from AWS Artifact, and you must only use HIPAA-eligible services listed by AWS.
Configure the training job to run in a VPC with only private subnets and no NAT gateway or internet gateway. Also, set the VPC's route tables to route traffic through VPC endpoints for any AWS services it needs (like S3). This prevents the training job from reaching the public internet.
It divides security responsibilities: AWS is responsible for the security of the cloud (physical data centres, hardware, networking infrastructure). You are responsible for security in the cloud (your data, encryption, IAM policies, OS patches on EC2 instances, and compliance with regulations like GDPR).
Yes, you can use a single KMS key to encrypt multiple resources, but the exam recommends using separate keys for different sensitivity levels or projects. Using separate keys gives you finer-grained control and reduces the blast radius if a key is compromised.
You've finished Security, Compliance, and Governance for ML Workloads. Continue through the MLS-C01 study guide to build a complete picture of the exam.
Done with this chapter?