SecurityConfiguration L2 construct
A security configuration is a set of security properties that can be used by AWS Glue to encrypt data at rest.
The following scenarios show some of the ways that you can use a security configuration.
- Attach a security configuration to an AWS Glue crawler to write encrypted Amazon CloudWatch Logs.
- Attach a security configuration to an extract, transform, and load (ETL) job to write encrypted Amazon Simple Storage Service (Amazon S3) targets and encrypted CloudWatch Logs.
- Attach a security configuration to an ETL job to write its jobs bookmarks as encrypted Amazon S3 data.
- Attach a security configuration to a development endpoint to write encrypted Amazon S3 targets.
Example
import * as cdk from 'aws-cdk-lib';
import * as iam from 'aws-cdk-lib/aws-iam';
declare const stack: cdk.Stack;
declare const role: iam.IRole;
declare const script: glue.Code;
new glue.PySparkEtlJob(stack, 'PySparkETLJob', {
jobName: 'PySparkETLJobCustomName',
description: 'This is a description',
role,
script,
glueVersion: glue.GlueVersion.V6_0,
continuousLogging: { enabled: false },
workerConfiguration: {
workerType: glue.WorkerType.G_2X,
numberOfWorkers: 2,
},
maxConcurrentRuns: 100,
timeout: cdk.Duration.hours(2),
connections: [glue.Connection.fromConnectionName(stack, 'Connection', 'connectionName')],
securityConfiguration: glue.SecurityConfiguration.fromSecurityConfigurationName(stack, 'SecurityConfig', 'securityConfigName'),
tags: {
FirstTagName: 'FirstTagValue',
SecondTagName: 'SecondTagValue',
XTagName: 'XTagValue',
},
maxRetries: 2,
});
import aws_cdk as cdk
import aws_cdk.aws_iam as iam
# stack: cdk.Stack
# role: iam.IRole
# script: glue.Code
glue.PySparkEtlJob(stack, "PySparkETLJob",
job_name="PySparkETLJobCustomName",
description="This is a description",
role=role,
script=script,
glue_version=glue.GlueVersion.V6_0,
continuous_logging=glue.ContinuousLoggingProps(enabled=False),
worker_configuration=glue.WorkerConfiguration(
worker_type=glue.WorkerType.G_2X,
number_of_workers=2
),
max_concurrent_runs=100,
timeout=cdk.Duration.hours(2),
connections=[glue.Connection.from_connection_name(stack, "Connection", "connectionName")],
security_configuration=glue.SecurityConfiguration.from_security_configuration_name(stack, "SecurityConfig", "securityConfigName"),
tags={
"FirstTagName": "FirstTagValue",
"SecondTagName": "SecondTagValue",
"XTagName": "XTagValue"
},
max_retries=2
)
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.iam.*;
Stack stack;
IRole role;
Code script;
PySparkEtlJob.Builder.create(stack, "PySparkETLJob")
.jobName("PySparkETLJobCustomName")
.description("This is a description")
.role(role)
.script(script)
.glueVersion(GlueVersion.V6_0)
.continuousLogging(ContinuousLoggingProps.builder().enabled(false).build())
.workerConfiguration(WorkerConfiguration.builder()
.workerType(WorkerType.G_2X)
.numberOfWorkers(2)
.build())
.maxConcurrentRuns(100)
.timeout(Duration.hours(2))
.connections(List.of(Connection.fromConnectionName(stack, "Connection", "connectionName")))
.securityConfiguration(SecurityConfiguration.fromSecurityConfigurationName(stack, "SecurityConfig", "securityConfigName"))
.tags(Map.of(
"FirstTagName", "FirstTagValue",
"SecondTagName", "SecondTagValue",
"XTagName", "XTagValue"))
.maxRetries(2)
.build();
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK;
using Amazon.CDK.AWS.IAM;
Stack stack;
IRole role;
Code script;
new PySparkEtlJob(stack, "PySparkETLJob", new PySparkEtlJobProps {
JobName = "PySparkETLJobCustomName",
Description = "This is a description",
Role = role,
Script = script,
GlueVersion = GlueVersion.V6_0,
ContinuousLogging = new ContinuousLoggingProps { Enabled = false },
WorkerConfiguration = new WorkerConfiguration {
WorkerType = WorkerType.G_2X,
NumberOfWorkers = 2
},
MaxConcurrentRuns = 100,
Timeout = Duration.Hours(2),
Connections = new [] { Connection.FromConnectionName(stack, "Connection", "connectionName") },
SecurityConfiguration = SecurityConfiguration.FromSecurityConfigurationName(stack, "SecurityConfig", "securityConfigName"),
Tags = new Dictionary<string, string> {
{ "FirstTagName", "FirstTagValue" },
{ "SecondTagName", "SecondTagValue" },
{ "XTagName", "XTagValue" }
},
MaxRetries = 2
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import cdk "github.com/aws/aws-cdk-go/awscdk"
import iam "github.com/aws/aws-cdk-go/awscdk"
var stack Stack
var role IRole
var script Code
glue.NewPySparkEtlJob(stack, jsii.String("PySparkETLJob"), &PySparkEtlJobProps{
JobName: jsii.String("PySparkETLJobCustomName"),
Description: jsii.String("This is a description"),
Role: Role,
Script: Script,
GlueVersion: glue.GlueVersion_V6_0,
ContinuousLogging: &ContinuousLoggingProps{
Enabled: jsii.Boolean(false),
},
WorkerConfiguration: &WorkerConfiguration{
WorkerType: glue.WorkerType_G_2X,
NumberOfWorkers: jsii.Number(2),
},
MaxConcurrentRuns: jsii.Number(100),
Timeout: cdk.Duration_Hours(jsii.Number(2)),
Connections: []IConnection{
glue.Connection_FromConnectionName(stack, jsii.String("Connection"), jsii.String("connectionName")),
},
SecurityConfiguration: glue.SecurityConfiguration_FromSecurityConfigurationName(stack, jsii.String("SecurityConfig"), jsii.String("securityConfigName")),
Tags: map[string]*string{
"FirstTagName": jsii.String("FirstTagValue"),
"SecondTagName": jsii.String("SecondTagValue"),
"XTagName": jsii.String("XTagValue"),
},
MaxRetries: jsii.Number(2),
})
Initializer
new SecurityConfiguration(scope: Construct, id: string, props?: SecurityConfigurationProps)
SecurityConfiguration(scope: Construct, id: str, props: typing.Optional[SecurityConfigurationProps] = None)
new SecurityConfiguration(Construct scope, String id, SecurityConfigurationProps props)
new SecurityConfiguration(Construct scope, string id, SecurityConfigurationProps? props = null)
NewSecurityConfiguration(Scope Construct, Id *string, Props SecurityConfigurationProps)
Construct Props
cloudWatchEncryptionoptionalCloudWatchEncryptioncloud_watch_encryptionoptionalCloudWatchEncryptioncloudWatchEncryptionoptionalCloudWatchEncryptionCloudWatchEncryptionoptionalCloudWatchEncryptionCloudWatchEncryptionoptionalCloudWatchEncryption#Default: no cloudwatch logs encryption.
jobBookmarksEncryptionoptionalJobBookmarksEncryptionjob_bookmarks_encryptionoptionalJobBookmarksEncryptionjobBookmarksEncryptionoptionalJobBookmarksEncryptionJobBookmarksEncryptionoptionalJobBookmarksEncryptionJobBookmarksEncryptionoptionalJobBookmarksEncryption#Default: no job bookmarks encryption.
removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy#Default: resource will be destroyed
s3EncryptionoptionalS3Encryptions3_encryptionoptionalS3Encryptions3EncryptionoptionalS3EncryptionS3EncryptionoptionalS3EncryptionS3EncryptionoptionalS3Encryption#Default: no s3 encryption.
securityConfigurationNameoptionalstringsecurity_configuration_nameoptionalstrsecurityConfigurationNameoptionalStringSecurityConfigurationNameoptionalstringSecurityConfigurationNameoptional*string#Default: generated by CDK.
Properties
cloudWatchEncryptionKeymay be undefinedIKeyRefcloud_watch_encryption_keymay be undefinedIKeyRefcloudWatchEncryptionKeymay be undefinedIKeyRefCloudWatchEncryptionKeymay be undefinedIKeyRefCloudWatchEncryptionKeymay be undefinedIKeyRef#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironment#notes
For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.
jobBookmarksEncryptionKeymay be undefinedIKeyRefjob_bookmarks_encryption_keymay be undefinedIKeyRefjobBookmarksEncryptionKeymay be undefinedIKeyRefJobBookmarksEncryptionKeymay be undefinedIKeyRefJobBookmarksEncryptionKeymay be undefinedIKeyRef#PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringstatic#s3EncryptionKeymay be undefinedIKeyRefs3_encryption_keymay be undefinedIKeyRefs3EncryptionKeymay be undefinedIKeyRefS3EncryptionKeymay be undefinedIKeyRefS3EncryptionKeymay be undefinedIKeyRef#securityConfigurationNamestringsecurity_configuration_namestrsecurityConfigurationNameStringSecurityConfigurationNamestringSecurityConfigurationName*string#Methods
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#notes · 1 parameter
When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#notes
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).
fromSecurityConfigurationName(scope: Construct, id: string, securityConfigurationName: string): ISecurityConfiguration@staticmethod def from_security_configuration_name(scope: Construct, id: str, security_configuration_name: str) -> ISecurityConfigurationpublic static ISecurityConfiguration fromSecurityConfigurationName(Construct scope, String id, String securityConfigurationName)public static ISecurityConfiguration FromSecurityConfigurationName(Construct scope, string id, string securityConfigurationName)func FromSecurityConfigurationName(Scope Construct, Id *string, SecurityConfigurationName *string) ISecurityConfigurationstatic#3 parameters
Parameters
scopescopescopescopeScope— The scope creating construct (usuallythis).ididididId— The construct's id.securityConfigurationNamesecurity_configuration_namesecurityConfigurationNamesecurityConfigurationNameSecurityConfigurationName— name of external security configuration.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.