aws / aws/aws-cdk

(glue): Code.fromBucket should work with encrypted buckets

Open
#20,255 2 comments 2 reactions 0 assignees View on GitHub
@aws-cdk/aws-glue bug effort/small p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

when using `glue.Code.fromBucket` to specify the `script` or `extraPythonFiles`, the L2 `glue.Job` construct automatically grants permissions to read from this bucket. however, if the bucket is encrypted, it doesn't take the extra step to grab permissions to use the required KMS key the decrypt the bucket contents

### Use Case

Internally at Amazon, we store stack assets in an account-wide encrypted bucket. I would like to simply pass in the bucket to the `glue.Job` construct and expect the permissions to be handled such that Glue can read from the provided bucket.

```typescript
new glue.Job(this, 'Job', {
executable: glue.JobExecutable.pythonEtl({
glueVersion: glue.GlueVersion.V3_0,
pythonVersion: glue.PythonVersion.THREE,
script: glue.Code.fromBucket(
props.barsBucket,
`${props.jobsLambdaAssetPrefix}/handlers/mygluejob.py`,
),
extraPythonFiles: [
glue.Code.fromBucket(
props.barsBucket,
`${props.jobsLambdaAssetPrefix}/artifact`,
),
],
}),
}),
```

### Proposed Solution

_No response_

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

1.154.0 (build 0d1b77f)

### Environment details (OS name and version, etc.)

Amazon Linux 2

Contributor guide

Open the contributing guide

Research direction

Start at the glue.Code.fromBucket and glue.Job entry points shown in the example, using an encrypted S3 bucket and the provided script or extraPythonFiles configuration. Check the permissions granted by the L2 glue.Job construct; done means Glue can read encrypted bucket contents with the required KMS key permissions.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.