-
Notifications
You must be signed in to change notification settings - Fork 356
Add Polaris blog about KMS #3331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| --- | ||
| # | ||
| # 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`. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we planning to CP #3330 this tp 1.3x ? and have a new RC ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess not. Let's not expand scope of 1.3.0
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was trying to understand more what the above statement meant, 1.3.1 could also be a following release. |
||
|
|
||
| ## 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 do not need to take any extra actions to benefit | ||
| from KMS-based server-side data encryption and decryption. This applies to engines (like Spark) | ||
| and to AWS clients used inside Polaris itself (for reading and writing metadata JSON files). | ||
|
|
||
| ## 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. This is necessary for the catalog server to properly form policies | ||
| associated with vended credentials so that accessing both old and new data is possible. | ||
|
|
||
| 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. | ||
|
Comment on lines
+89
to
+90
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we plan to merge this blog post cli pr gets merged ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, CLI needs to go first |
||
|
|
||
| Note: the key material may be automatically rotated by AWS services (if configured) without introducing a new key ARN, | ||
| in that case no catalog changes are necessary. | ||
|
|
||
| ## Acknowledgements | ||
|
|
||
| KMS support in Polaris was made possible through collaboration with many community members, specifically involving PRs | ||
| #[1424](https://github.com/apache/polaris/pull/1424) by [fivetran-ashokborra](https://github.com/fivetran-ashokborra) | ||
| and #[2802](https://github.com/apache/polaris/pull/2802) by [fabio-rizzo-01](https://github.com/fabio-rizzo-01). | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: do we need (incubating) here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess not... the statement below already mentions a specific incubating version, plus the site's front page has the appropriate "incubating" designation.