Open austinmw opened 1 year ago
Thank you. I am making it p2 feature request now and any pull request or upvotes would be appreciated.
You can use Source.data
for single files:
import { App, Stack } from 'aws-cdk-lib/core'
import { Bucket } from "aws-cdk-lib/aws-s3"
import { BucketDeployment, Source } from "aws-cdk-lib/aws-s3-deployment"
import * as fs from "fs";
import * as path from "path";
const app = new App();
const stack = new Stack(app, "Stack");
const integBucket = new Bucket(stack, "Bucket");
new BucketDeployment(stack, "Deploy", {
sources: [
Source.data("Readme.md", fs.readFileSync(path.resolve(__dirname, "..", "README.md")).toString())
],
destinationBucket: integBucket
})
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 thes3_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
(withtool.poetry.group
's) to install the dependencies for either.Here's a shortened version of the directory structure:
Ideally I would like the directories
src
,examples
, andsample_datasets
, as well as the single filesMakefile
,pyproject.toml
,poetry.toml
,poetry.lock
, andenvironment.yml
placed in my S3 bucket.Acknowledgements
CDK version used
2.70.0 (build c13a0f1)
Environment details (OS name and version, etc.)
macOS Monterey 12.6.3