singhpk234 commented on code in PR #3331: URL: https://github.com/apache/polaris/pull/3331#discussion_r2647440780
########## site/content/blog/2025/12/24/aws-kms.md: ########## @@ -0,0 +1,96 @@ +--- +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +title: "Securing S3 data with AWS KMS" +date: 2025-12-24 +author: Dmitri Bourlatchkov +--- +## Introduction + +AWS [Key Management Service](https://docs.aws.amazon.com/kms/latest/developerguide/overview.html) (KMS) provides +a way to encrypt S3 data in AWS without exposing raw key material outside AWS services. + +Apache Polaris supports using KMS in its catalogs backed by AWS S3 storage. + +The core functionality is available via Polaris REST API since the `1.2.0-incubating` release. +CLI support will be made available in the release following `1.3.0-incubating`. + +## Configuring Polaris Catalog + +KMS settings in Polaris are relevant to S3 buckets that have been confugure to use KMS on the AWS side +(e.g. using SSE-KMS). + +Make a note of the KMS keys ARN that the bucket uses and pass it to the `--current-kms-key` CLI option +when creating the corresponding Polaris Catalog. + +For example: + +```shell +./polaris \ + --client-id ${POLARIS_CLIENT_ID} \ + --client-secret ${POLARIS_CLIENT_SECRET} \ + catalogs \ + create \ + --storage-type s3 \ + --default-base-location ${S3_LOCATION_URI} \ + --role-arn ${ROLE_ARN} \ + --region ${REGION} \ + --external-id ${EXTERNAL_ID} \ + --current-kms-key ${KMS_ARN} \ + quickstart_catalog +``` + +Once the KMS key is configured in the catalog, Polaris will automatically add appropriate access +policy entries to vended credentials. Clients (such as Spark) do not need to take any extra actions +to benefit from KMS-based server-side data encryption and decryption. + +## Common Failure Modes + +If KMS keys are associated with the S3 bucket, but not configured in Polaris, clients will face +runtime errors when communicating with S3 APIs. The following example is from Spark. + +``` +25/12/24 14:32:20 ERROR SparkSQLDriver: Failed in [select * from ns.t1] +software.amazon.awssdk.services.s3.model.S3Exception: User: arn:aws:sts::123456789012:assumed-role/polaris/PolarisAwsCredentialsStorageIntegration is not authorized to perform: kms:Decrypt on resource: arn:aws:kms:us-west-2:123456789012:key/abcd1234-1111-2222-3333-444444444444 because no session policy allows the kms:Decrypt action (Service: S3, Status Code: 403, Request ID: ****************, Extended Request ID: *****) +``` + +``` +spark-sql ()> insert into ns.t1 values ('test'); +[...] +25/12/24 14:24:49 ERROR AppendDataExec: Data source write support IcebergBatchWrite(table=polaris.ns.t1, format=PARQUET) aborted. +Job aborted due to stage failure: Task 0 in stage 3.0 failed 1 times, most recent failure: Lost task 0.0 in stage 3.0 (TID 3) (192.168.68.56 executor driver): java.io.UncheckedIOException: Failed to close current writer +[...] +Caused by: java.io.IOException: software.amazon.awssdk.services.s3.model.S3Exception: User: arn:aws:sts::123456789012:assumed-role/polaris/PolarisAwsCredentialsStorageIntegration is not authorized to perform: kms:GenerateDataKey on resource: arn:aws:kms:us-west-2:123456789012:key/abcd1234-1111-2222-3333-444444444444 because no session policy allows the kms:GenerateDataKey action (Service: S3, Status Code: 403, Request ID: ****************, Extended Request ID: ************) +``` + +## Using Multiple KMS Keys + +If the bucket used by the catalog has had multiple different KMS key ARNs associated with it over time, +Polaris needs to know all related key ARNs in order to properly form policies for accessing old and new data. + +This can be achieved by using the `--allowed-kms-key` CLI option to add zero or more extra KMS key ARNs to the +catalog's storage configuration. + +Note: if the key material is rotated without introducing a new key ARN, no catalog changes are necessary. Review Comment: didn't fully get this part, can you please elaborate ########## site/content/blog/2025/12/24/aws-kms.md: ########## @@ -0,0 +1,96 @@ +--- +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +title: "Securing S3 data with AWS KMS" +date: 2025-12-24 +author: Dmitri Bourlatchkov +--- +## Introduction + +AWS [Key Management Service](https://docs.aws.amazon.com/kms/latest/developerguide/overview.html) (KMS) provides +a way to encrypt S3 data in AWS without exposing raw key material outside AWS services. + +Apache Polaris supports using KMS in its catalogs backed by AWS S3 storage. Review Comment: minor: do we need (incubating) here ? ########## site/content/blog/2025/12/24/aws-kms.md: ########## @@ -0,0 +1,96 @@ +--- +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +title: "Securing S3 data with AWS KMS" +date: 2025-12-24 +author: Dmitri Bourlatchkov +--- +## Introduction + +AWS [Key Management Service](https://docs.aws.amazon.com/kms/latest/developerguide/overview.html) (KMS) provides +a way to encrypt S3 data in AWS without exposing raw key material outside AWS services. + +Apache Polaris supports using KMS in its catalogs backed by AWS S3 storage. + +The core functionality is available via Polaris REST API since the `1.2.0-incubating` release. +CLI support will be made available in the release following `1.3.0-incubating`. + +## Configuring Polaris Catalog + +KMS settings in Polaris are relevant to S3 buckets that have been confugure to use KMS on the AWS side +(e.g. using SSE-KMS). + +Make a note of the KMS keys ARN that the bucket uses and pass it to the `--current-kms-key` CLI option +when creating the corresponding Polaris Catalog. + +For example: + +```shell +./polaris \ + --client-id ${POLARIS_CLIENT_ID} \ + --client-secret ${POLARIS_CLIENT_SECRET} \ + catalogs \ + create \ + --storage-type s3 \ + --default-base-location ${S3_LOCATION_URI} \ + --role-arn ${ROLE_ARN} \ + --region ${REGION} \ + --external-id ${EXTERNAL_ID} \ + --current-kms-key ${KMS_ARN} \ + quickstart_catalog +``` + +Once the KMS key is configured in the catalog, Polaris will automatically add appropriate access +policy entries to vended credentials. Clients (such as Spark) do not need to take any extra actions +to benefit from KMS-based server-side data encryption and decryption. Review Comment: do we wanna say polaris will also use this for encryption the metadata.json (a metadata file it produces ?) or is it too much info -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
