# SecurityConfiguration

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.

Extends: [Construct](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Construct.html) › [Resource](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Resource.html) › SecurityConfiguration
Implements: [IResource](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResource.html), [ISecurityConfiguration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.ISecurityConfiguration.html), [IEnvironmentAware](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.IEnvironmentAware.html), [IConstruct](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.IConstruct.html), IDependable

- CloudFormation: [`AWS::Glue::SecurityConfiguration`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-glue-securityconfiguration.html)
- L1 type: [`CfnSecurityConfiguration`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.CfnSecurityConfiguration.html)
- Source: [`aws-glue/lib/security-configuration.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-glue/lib/security-configuration.ts#L177)
- Type last changed: v2.270.0 · 17 Sep 2026

## Example

TypeScript:

```ts
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,
});
```

Python:

```python
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
)
```

Java:

```java
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();
```

C# / .NET:

```csharp
// 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
});
```

Golang:

```go
// 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

TypeScript:

```ts
new SecurityConfiguration(scope: Construct, id: string, props?: SecurityConfigurationProps)
```

Python:

```python
SecurityConfiguration(scope: Construct, id: str, props: typing.Optional[SecurityConfigurationProps] = None)
```

Java:

```java
new SecurityConfiguration(Construct scope, String id, SecurityConfigurationProps props)
```

C# / .NET:

```csharp
new SecurityConfiguration(Construct scope, string id, SecurityConfigurationProps? props = null)
```

Golang:

```go
NewSecurityConfiguration(Scope Construct, Id *string, Props SecurityConfigurationProps)
```

## Construct Props

- `cloudWatchEncryption`: [CloudWatchEncryption](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.CloudWatchEncryption.html) — The encryption configuration for Amazon CloudWatch Logs.

  **Default:** no cloudwatch logs encryption.

- `jobBookmarksEncryption`: [JobBookmarksEncryption](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.JobBookmarksEncryption.html) — The encryption configuration for Glue Job Bookmarks.

  **Default:** no job bookmarks encryption.

- `removalPolicy`: [RemovalPolicy](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.RemovalPolicy.html) — Policy to apply when the security configuration is removed from the stack.

  **Default:** resource will be destroyed

- `s3Encryption`: [S3Encryption](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.S3Encryption.html) — The encryption configuration for Amazon Simple Storage Service (Amazon S3) data.

  **Default:** no s3 encryption.

- `securityConfigurationName`: string — The name of the security configuration.

  **Default:** generated by CDK.

## Properties

- `cloudWatchEncryptionKey`: [IKeyRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_kms.IKeyRef.html) — The KMS key used in CloudWatch encryption if it requires a kms key.

- `env`: [ResourceEnvironment](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  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.

- `jobBookmarksEncryptionKey`: [IKeyRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_kms.IKeyRef.html) — The KMS key used in job bookmarks encryption if it requires a kms key.

- `node`: [Node](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `PROPERTY_INJECTION_ID`: string (static) — Uniquely identifies this class.

- `s3EncryptionKey`: [IKeyRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_kms.IKeyRef.html) — The KMS key used in S3 encryption if it requires a kms key.

- `securityConfigurationName`: string — The name of the security configuration.

- `stack`: [Stack](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

## Methods

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  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**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  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` (static) — Creates a Connection construct that represents an external security configuration.

  **Parameters**

  - `scope` — The scope creating construct (usually `this`).
  - `id` — The construct's id.
  - `securityConfigurationName` — name of external security configuration.

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  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**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  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.
