在AWS Glue作业中写入S3时是否可以指定SSE:KMS密钥ID? [英] Can a SSE:KMS Key ID be specified when writing to S3 in an AWS Glue Job?

查看:147
本文介绍了在AWS Glue作业中写入S3时是否可以指定SSE:KMS密钥ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您遵循AWS Glue添加作业向导创建脚本以将镶木地板文件写入S3,则最终会生成类似以下的代码.

If you follow the AWS Glue Add Job Wizard to create a script to write parquet files to S3 you end up with generated code something like this.

datasink4 = glueContext.write_dynamic_frame.from_options(
    frame=dropnullfields3,
    connection_type="s3",
    connection_options={"path": "s3://my-s3-bucket/datafile.parquet"},
    format="parquet",
    transformation_ctx="datasink4",
)

是否可以指定KMS密钥,以便在存储桶中对数据进行加密?

Is it possible to specify a KMS key so that the data is encrypted in the bucket?

推荐答案

胶水scala作业

val spark: SparkContext = new SparkContext()
val glueContext: GlueContext = new GlueContext(spark)
spark.hadoopConfiguration.set("fs.s3.enableServerSideEncryption", "true")
spark.hadoopConfiguration.set("fs.s3.serverSideEncryption.kms.keyId", args("ENCRYPTION_KEY"))

我认为Python的语法应该有所不同,但思路相同

I think syntax should be differ for Python, but idea the same

这篇关于在AWS Glue作业中写入S3时是否可以指定SSE:KMS密钥ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆