I am trying to create a Cloudformation template that creates an S3 bucket. I want to configure it so that the bucket is named using one of the parameters passed into the template. I am able to substitute the param in other places in the template, but the bucket creation fails when I try and sub it in here.
Resources:
S3Bucket:
Type: 'AWS::S3::Bucket'
Properties:
BucketName: !Sub '${STRING_PARAM}-example-bucketname'
This gives a Bad Request (Service: Amazon S3; Status Code: 400; Error Code: 400 Bad Request when the cloudformation stack is created. I've tried hard coding in the name which has worked, so I'm pretty sure it's a valid S3 bucket name.
Per S3 Creation CloudFormation results in 400 Bad Request referring (! Ref instead of ! Sub) to the param/resource directly works, but I'm thinking I should be able to sub the param in here like everywhere else.