[aws-s3-deployment] support for empty folder deployement
See original GitHub issueDescription
With the following assets folder:
assets/ |----> FolderA/
Instantiate BucketDeployement has no effect.
new BucketDeployment(this, "DeployWebsite", {
sources: [Source.asset("./assets")],
destinationBucket: myBucket
}); // no effect
What would be expected?
A bucket with the following structure:
Mybucket: |----> FolderA/
Use Case
required to generate folder-level access bucket policies
Proposed Solution
As a workaround, i use empty file to force BucketDeployement to render the folder structures And delete the empty file afterwards
assets/ |----> FolderA/ ---->emptyFiles.txt
Other
- 👋 I may be able to implement this feature request
- ⚠️ This feature might incur a breaking change
This is a 🚀 Feature Request
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:6 (1 by maintainers)
Top Results From Across the Web
aws-cdk/aws-s3-deployment module - AWS Documentation
IMPORTANT The aws-s3-deployment module is only intended to be used with zip files from trusted sources. Directories bundled by the CDK CLI (by...
Read more >Emptying a bucket - Amazon Simple Storage Service
You can empty a bucket's contents using the Amazon S3 console, AWS SDKs, or AWS Command Line Interface (AWS CLI). When you empty...
Read more >Organizing objects in the Amazon S3 console using folders
Use the Amazon S3 console to create folders that you can use to group your objects.
Read more >Create a pipeline that uses Amazon S3 as a deployment ...
Even if you delete files from the source repository, the S3 deploy action does not delete S3 objects corresponding to deleted files. This...
Read more >Use custom resources with Amazon S3 buckets in ...
The template allows you to create folders in S3 buckets. Amazon S3 has a flat structure, but supports the folder concept as a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I personally think this is still a valid feature request. If someone wants to close it as “won’t ever get around to implementing this” then fair enough, but I don’t think the fact that it hasn’t seen any attention in the last year invalidates the requirement.
S3 has no concept of folders though. S3 is an object store. Each object is a blob, which is identified by a key. A folder is not an object or a blob. It’s a filesystem concept.
The folders are an illusion made by AWS Console. If you use
/
in the object key name, then the console will pretend the key paths are folders. But as far as the underlying protocol and APIs are concerned - there are no folders, just keys.The workaround is super simple though. Create a dummy object:
your-desired-dir/.keep
.You can do it directly from the Source class, without ever needing this file to exist on disk prior: