https://pulumi.com logo
#general
Title
# general
w

witty-barista-69390

08/29/2022, 9:53 PM
What would be the best way to create a s3 bucket then create a folder structure as part of the setup?
s

stocky-restaurant-98004

08/29/2022, 10:02 PM
As far as I can tell, you can't create folders per se outside of the AWS Console (neither TF nor CF nor the CloudControl API supports it). The next best thing I would try is to just put an empty text file called
.s3folderkeep
or something (like
.gitkeep
since git also does not allow for empty folders).
w

witty-barista-69390

08/29/2022, 10:12 PM
Gotcha, so just create a dummy file and use s3.BucketObject to force it to create the folder
s

stocky-restaurant-98004

08/29/2022, 10:54 PM
Yeah. I think that's the best you can do.
b

big-agent-83308

08/30/2022, 3:36 AM
There are no "folders" in S3 - they are zero byte objects where the keys end in a
/
So yep, create a BucketObject with the required folder path as it's key
3 Views