How to specify S3 bucket VersioningConfiguration in serverless.yml

Disclaimer: I’m new to serverless. I’m trying to configure an S3 bucket that my function will use. I need it to be encrypted and keep versions. I assumed the property names would align to cloud formation docs, but I got an error (see below)

Here’s the yaml I’m trying to use:

resources:
Resources:
MyBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: my-bucket
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
VersioningConfiguration: Enabled
LoggingConfiguration:
DestinationBucketName: my-bucket-logs
LogFilePrefix: access-

And I get this error:

An error occurred: MyBucket - Encountered unsupported property VersioningConfiguration.

Is this feature supported in serverless.yml?

They do. According to the docs it should be

VersioningConfiguration:
  Status: Enabled
1 Like