# Create S3 Bucket with AllowedPattern

**URL:** <https://forum.serverless.com/t/create-s3-bucket-with-allowedpattern/16456>\
**Category:** Serverless Framework\
**Created:** [December 24, 2021, 6:10am UTC](https://forum.serverless.com/t/create-s3-bucket-with-allowedpattern/16456 "2021-12-24T06:10:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dburmeister](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/dburmeister/32/6454_2.png) [@dburmeister](https://forum.serverless.com/u/dburmeister)\
**Post date:** [December 24, 2021, 6:10am UTC](https://forum.serverless.com/t/create-s3-bucket-with-allowedpattern/16456/1 "2021-12-24T06:10:46Z")

</div>

In the serverless.yml file under the resources section I am creating a S3 bucket it works but now I want to make it better by adding the AllowedPattern to only allow images in to the bucket but I keep getting the following error (is it just because I don’t know what kinds of regex it is looking for?)

Serverless: Deprecation warning: Variables resolver reports following resolution errors:  
- Cannot resolve variable at “resources.Resources”: Cannot parse “config/resource.yml”: unknown escape sequence in “/codebuild/output/src951772159/src/config/resource.yml” (24:24)

```
         21 | Properties:
         22 | BucketName: '${env:STAGE}-${self:custom.imageUploa ...
         23 | AccessControl: PublicRead
         24 | AllowedPattern: "/\.(gif|jpe?g|tiff?|png|webp|bmp)"/ig
        -----------------------------^

```

This is part of the serverless.yml file

ImageUploadBucket:  
Type: ‘AWS::S3::Bucket’  
Properties:  
BucketName: ‘${env:STAGE}-${self:custom.imageUploadBucket}’  
AccessControl: PublicRead  
AllowedPattern: “/.(gif|jpe?g|tiff?|png|webp|bmp)”/ig  
CorsConfiguration:  
CorsRules:
