How can I create a s3 bucket subdirectory (Serverless)?

Viewed 1504

When I try to create a subdirectory on my serverless.yml, I get the following error:

An error occurred: S3Bucket - Bucket name should not contain '/'.

Here’s the code:

resources:
 Resources:
   S3Bucket:
     Type: AWS::S3::Bucket
     Properties:
       BucketName: "bucketname/sub"

How can I create bucket subdirectories through serverless.yml?

2 Answers

You can only create S3 bucket using serverless framework. Any folder/object can only be created using SDK or console.

AWS S3 buckets don't have directories, they just appear to when a filename has a / in it.

See this question.

Related