TableClientSideEncryption Class
Client-side encryption for an S3Table's data.
Independent of the bucket's server-side encryption and of who owns the bucket: the data is encrypted by the client before it is written to S3. When set, the grant* methods also grant the relevant KMS permissions on the key.
Example
ts
declare const myDatabase: glue.Database;
// KMS key is created automatically
new glue.S3Table(this, 'MyTable', {
clientSideEncryption: glue.TableClientSideEncryption.kms(),
// ...
database: myDatabase,
columns: [{
name: 'col1',
type: glue.Schema.STRING,
}],
dataFormat: glue.DataFormat.JSON,
});
// with an explicit KMS key
new glue.S3Table(this, 'MyTable', {
clientSideEncryption: glue.TableClientSideEncryption.kms(new kms.Key(this, 'MyKey')),
// ...
database: myDatabase,
columns: [{
name: 'col1',
type: glue.Schema.STRING,
}],
dataFormat: glue.DataFormat.JSON,
});
python
# my_database: glue.Database
# KMS key is created automatically
glue.S3Table(self, "MyTable",
client_side_encryption=glue.TableClientSideEncryption.kms(),
# ...
database=my_database,
columns=[glue.Column(
name="col1",
type=glue.Schema.STRING
)],
data_format=glue.DataFormat.JSON
)
# with an explicit KMS key
glue.S3Table(self, "MyTable",
client_side_encryption=glue.TableClientSideEncryption.kms(kms.Key(self, "MyKey")),
# ...
database=my_database,
columns=[glue.Column(
name="col1",
type=glue.Schema.STRING
)],
data_format=glue.DataFormat.JSON
)
java
Database myDatabase;
// KMS key is created automatically
// KMS key is created automatically
S3Table.Builder.create(this, "MyTable")
.clientSideEncryption(TableClientSideEncryption.kms())
// ...
.database(myDatabase)
.columns(List.of(Column.builder()
.name("col1")
.type(Schema.STRING)
.build()))
.dataFormat(DataFormat.JSON)
.build();
// with an explicit KMS key
// with an explicit KMS key
S3Table.Builder.create(this, "MyTable")
.clientSideEncryption(TableClientSideEncryption.kms(new Key(this, "MyKey")))
// ...
.database(myDatabase)
.columns(List.of(Column.builder()
.name("col1")
.type(Schema.STRING)
.build()))
.dataFormat(DataFormat.JSON)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Database myDatabase;
// KMS key is created automatically
// KMS key is created automatically
new S3Table(this, "MyTable", new S3TableProps {
ClientSideEncryption = TableClientSideEncryption.Kms(),
// ...
Database = myDatabase,
Columns = new [] { new Column {
Name = "col1",
Type = Schema.STRING
} },
DataFormat = DataFormat.JSON
});
// with an explicit KMS key
// with an explicit KMS key
new S3Table(this, "MyTable", new S3TableProps {
ClientSideEncryption = TableClientSideEncryption.Kms(new Key(this, "MyKey")),
// ...
Database = myDatabase,
Columns = new [] { new Column {
Name = "col1",
Type = Schema.STRING
} },
DataFormat = DataFormat.JSON
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var myDatabase Database
// KMS key is created automatically
// KMS key is created automatically
glue.NewS3Table(this, jsii.String("MyTable"), &S3TableProps{
ClientSideEncryption: glue.TableClientSideEncryption_Kms(),
// ...
Database: myDatabase,
Columns: []Column{
&Column{
Name: jsii.String("col1"),
Type: glue.Schema_STRING(),
},
},
DataFormat: glue.DataFormat_JSON(),
})
// with an explicit KMS key
// with an explicit KMS key
glue.NewS3Table(this, jsii.String("MyTable"), &S3TableProps{
ClientSideEncryption: glue.TableClientSideEncryption_*Kms(kms.NewKey(this, jsii.String("MyKey"))),
// ...
Database: myDatabase,
Columns: []Column{
&Column{
Name: jsii.String("col1"),
Type: glue.Schema_STRING(),
},
},
DataFormat: glue.DataFormat_JSON(),
})
Methods
kms(key?: IKeyRef): TableClientSideEncryption // chainable@staticmethod def kms(key: typing.Optional[IKeyRef] = None) -> TableClientSideEncryptionpublic static TableClientSideEncryption kms(IKeyRef key)public static TableClientSideEncryption Kms(IKeyRef? key = null)func Kms(Key IKeyRef) TableClientSideEncryptionstatic#Client-side encryption (CSE-KMS) with an AWS KMS key managed by the account owner.
1 parameter
Parameters
keykeykeykeyKey— the KMS key used to encrypt the data.