aws / aws/aws-cdk

BucketDeployment: single files

Open
#24,787 5 comments 4 reactions 0 assignees View on GitHub
@aws-cdk/aws-s3 effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Hi, I'd love to be able to deploy single files in addition to directories and zip files using BucketDeployment.

### Use Case

Due to the directory structure of my codebase I'm not able to move all single files into a folder or zip prior to cdk deployment. Currently I'm working around this by using `with TemporaryDirectory() as temp_dir:` in my CDK stack and using this temp_dir as the `s3_deployment.Source.asset`, however, this feels like the wrong way to do things.

### Proposed Solution

I assume there is a justification for not including this functionality originally, but it'd be great if it were added in some way.

### Other Information

Essentially my project structure contains a CDK app and a python library. I'd like to be able to use poetry and the same `pyproject.toml` (with `tool.poetry.group`'s) to install the dependencies for either.

Here's a shortened version of the directory structure:

```
├── Makefile
├── pyproject.toml
├── poetry.toml
├── poetry.lock
├── environment.yml
├── app.py
├── cdk.json
├── docs/
├── examples/
├── lifecycles/
├── src/mypythonlibrary/
├── sample_datasets/
├── stacks/
└── tests/
```

Ideally I would like the directories `src`, `examples`, and `sample_datasets`, as well as the single files `Makefile`, `pyproject.toml`, `poetry.toml`, `poetry.lock`, and `environment.yml` placed in my S3 bucket.

### Acknowledgements

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

### CDK version used

2.70.0 (build c13a0f1)

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

macOS Monterey 12.6.3

Contributor guide

Open the contributing guide

Research direction

Start at the BucketDeployment construct and the s3_deployment.Source.asset entry point, then inspect how directory and zip sources are currently handled. Define how single files should be combined with directories and verify that the requested files and directories are placed in the S3 bucket without changing existing source behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.