# S3Code

Glue job Code from an S3 bucket.

Extends: [Code](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.Code.html) › S3Code
Obtainable from: [Code.fromBucket](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.Code.html#frombucket)

- Source: [`aws-glue/lib/code.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-glue/lib/code.ts#L40)
- Type last changed: v2.270.0 · 17 Sep 2026

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_glue as glue } from 'aws-cdk-lib';
import { aws_s3 as s3 } from 'aws-cdk-lib';

declare const bucket: s3.Bucket;
const s3Code = new glue.S3Code(bucket, 'key');
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_glue as glue
from aws_cdk import aws_s3 as s3

# bucket: s3.Bucket

s3_code = glue.S3Code(bucket, "key")
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.glue.*;
import software.amazon.awscdk.services.s3.*;

Bucket bucket;

S3Code s3Code = new S3Code(bucket, "key");
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Glue;
using Amazon.CDK.AWS.S3;

Bucket bucket;

var s3Code = new S3Code(bucket, "key");
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var bucket Bucket

s3Code := awscdk.Aws_glue.NewS3Code(bucket, jsii.String("key"))
```

## Initializer

TypeScript:

```ts
new S3Code(bucket: IBucket, key: string)
```

Python:

```python
S3Code(bucket: IBucket, key: str)
```

Java:

```java
new S3Code(IBucket bucket, String key)
```

C# / .NET:

```csharp
new S3Code(IBucket bucket, string key)
```

Golang:

```go
NewS3Code(Bucket IBucket, Key *string)
```

## Methods

- `bind(_scope: Construct, grantable: IGrantable): CodeConfig` — Called when the Job is initialized to allow this object to bind.

- `fromAsset(path: string, options?: AssetOptions): AssetCode` (static) — Job code from a local disk path.

  **Parameters**

  - `path` — code file (not a directory).

- `fromBucket(bucket: IBucket, key: string): S3Code // chainable` (static) — Job code as an S3 object.

  **Parameters**

  - `bucket` — The S3 bucket.
  - `key` — The object key.
