Back to Checks
aws

SageMaker endpoint configuration is encrypted with a KMS key

sagemaker_endpoint_config_kms_encryption_enabled
Service: sagemakerSeverity: medium
OfficialBuilt-inVerified
Categories:encryptiongen-ai
Resource Type:Other

Amazon SageMaker endpoint configurations are assessed for at-rest encryption using an AWS KMS key. The finding reflects whether a KmsKeyId is configured on the endpoint configuration so inference data volumes and related storage use KMS encryption.

Risk

Without at-rest encryption using a KMS key on endpoint configurations, model artifacts and inference-related data may be exposed through storage access or compromised hosts, reducing confidentiality and limiting key rotation and revocation controls.

Run this check with Prowler

Run in Prowler Cloud
Run
prowler aws --checks sagemaker_endpoint_config_kms_encryption_enabled

Recommendation

Always set KmsKeyId on SageMaker endpoint configurations. Prefer a customer-managed KMS key with least-privilege key policies, enable rotation, and ensure endpoints are updated to use the encrypted configuration.

Remediation

CLI

aws sagemaker create-endpoint-config --endpoint-config-name <endpoint-config-name> --production-variants VariantName=AllTraffic,ModelName=<model-name>,InitialInstanceCount=1,InstanceType=ml.m5.large --kms-key-id <kms-key-id>

Terraform

# SageMaker endpoint configuration with KMS encryption
resource "aws_sagemaker_endpoint_configuration" "<example_resource_name>" {
  name        = "<example_resource_name>"
  kms_key_arn = "<example_resource_arn>" # Critical: enables at-rest encryption with KMS

  production_variants {
    variant_name           = "AllTraffic"
    model_name             = "<example_resource_name>"
    instance_type          = "ml.m5.large"
    initial_instance_count = 1
  }
}

NativeIaC

# CloudFormation: SageMaker EndpointConfig with KMS encryption
Resources:
  <example_resource_name>:
    Type: AWS::SageMaker::EndpointConfig
    Properties:
      ProductionVariants:
        - VariantName: AllTraffic
          ModelName: <example_resource_name>
          InitialInstanceCount: 1
          InstanceType: ml.m5.large
      KmsKeyId: <example_resource_id>  # Critical: encrypts endpoint data at rest with KMS

Other

1Open Amazon SageMaker > Inference > Endpoint configurations
2Create a new endpoint configuration (endpoint configs are immutable)
3Configure production variants as required
4Under Encryption, select a KMS key
5Create the configuration and update any endpoints to use the new encrypted configuration
6Delete the old unencrypted endpoint configuration when safe

Check Code

from typing import List

from prowler.lib.check.models import Check, Check_Report_AWS
from prowler.providers.aws.services.sagemaker.sagemaker_client import sagemaker_client


class sagemaker_endpoint_config_kms_encryption_enabled(Check):
    """Ensure SageMaker endpoint configurations encrypt data at rest with a KMS key."""

    def execute(self) -> List[Check_Report_AWS]:
        """Return PASS/FAIL findings for each SageMaker endpoint configuration."""
        findings = []
        for endpoint_config in sagemaker_client.endpoint_configs.values():
            report = Check_Report_AWS(
                metadata=self.metadata(), resource=endpoint_config
            )
            report.status = "PASS"
            report.status_extended = (
                f"Sagemaker Endpoint Config {endpoint_config.name} has data encryption "
                f"enabled with KMS key."
            )
            if not endpoint_config.kms_key_id:
                report.status = "FAIL"
                report.status_extended = (
                    f"Sagemaker Endpoint Config {endpoint_config.name} does not have "
                    f"data encryption enabled with a KMS key."
                )

            findings.append(report)

        return findings