# An error occurred: BucketPolicy - Cannot modify S3 policy of a bucket in different region

**URL:** https://forum.serverless.com/t/an-error-occurred-bucketpolicy-cannot-modify-s3-policy-of-a-bucket-in-different-region/5968
**Category:** Serverless Framework
**Tags:** aws
**Created:** [September 28, 2018, 10:33am UTC](https://forum.serverless.com/t/an-error-occurred-bucketpolicy-cannot-modify-s3-policy-of-a-bucket-in-different-region/5968 "2018-09-28T10:33:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![khinester](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/khinester/32/315_2.png) [@khinester](https://forum.serverless.com/u/khinester)
#### Post date: [September 28, 2018, 10:33am UTC](https://forum.serverless.com/t/an-error-occurred-bucketpolicy-cannot-modify-s3-policy-of-a-bucket-in-different-region/5968/1 "2018-09-28T10:33:00Z")

</div>

Hello,  
I have the following serverless.yml

```
service: eshot

provider:
  name: aws
  runtime: go1.x
  iamRoleStatements:
    - Effect: Allow
      Action:
        - s3:getObject
        - s3:putBucketPolicy
      Resource: "*"
  stage: ${opt:stage}
  region: ${file(./config.yml):${opt:stage}.REGION}
  environment:
    ESHOT_UPLOADS_BUCKET: ${file(./config.yml):${opt:stage}.ESHOT_UPLOADS_BUCKET}

package:
 exclude:
   - ./**
 include:
   - ./eshot

functions:
  eshot:
    handler: eshot
    memorySize: 128
    events:
      - s3:
          bucket: ${file(./config.yml):${opt:stage}.ESHOT_UPLOADS_BUCKET}
          event: s3:ObjectCreated:*
    timeout: 300
    environment:
      TOKEN: ${file(./config.yml):${opt:stage}.TOKEN}

resources:
  Resources:
    EshotBucketPolicy:
      Type: AWS::S3::BucketPolicy
      Properties:
        Bucket: ${file(./config.yml):${opt:stage}.ESHOT_UPLOADS_BUCKET}
        PolicyDocument:
          Statement:
            - Action:
                - s3:putObject
              Effect: "Allow"
              Principal: "*"
              Resource:
                - "arn:aws:s3:::${file(./config.yml):${opt:stage}.ESHOT_UPLOADS_BUCKET}/*.xls"
                - "arn:aws:s3:::${file(./config.yml):${opt:stage}.ESHOT_UPLOADS_BUCKET}/*.csv"
                - "arn:aws:s3:::${file(./config.yml):${opt:stage}.ESHOT_UPLOADS_BUCKET}/*.tsv"
                - "arn:aws:s3:::${file(./config.yml):${opt:stage}.ESHOT_UPLOADS_BUCKET}/*.xlsx"

```

but keep getting this error:

```
 khinester@MBM-DT111  /c/Users/norman.khine/go/src/eshot   master ●  sls deploy --stage staging --region eu-west-1  1 ↵  502  11:12:26
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
.....
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (6.67 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
..........
Serverless: Operation failed!

  Serverless Error ---------------------------------------

  An error occurred: EshotBucketPolicy - Cannot modify S3 policy of a bucket in different region..

  Get Support --------------------------------------------
     Docs: docs.serverless.com
     Bugs: github.com/serverless/serverless/issues
     Issues: forum.serverless.com

  Your Environment Information -----------------------------
     OS: linux
     Node Version: 8.12.0
     Serverless Version: 1.32.0

```

what am i missing?

any advice is much appreciated

---

<div class="post-metadata">

### Author: ![khinester](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/khinester/32/315_2.png) [@khinester](https://forum.serverless.com/u/khinester)
#### Post date: [September 28, 2018, 2:57pm UTC](https://forum.serverless.com/t/an-error-occurred-bucketpolicy-cannot-modify-s3-policy-of-a-bucket-in-different-region/5968/2 "2018-09-28T14:57:33Z")

</div>

it seems the bucket name exists

---

<div class="post-metadata">

### Author: ![matt2xu](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/matt2xu/32/3196_2.png) [@matt2xu](https://forum.serverless.com/u/matt2xu)
#### Post date: [April 2, 2019, 12:49pm UTC](https://forum.serverless.com/t/an-error-occurred-bucketpolicy-cannot-modify-s3-policy-of-a-bucket-in-different-region/5968/3 "2019-04-02T12:49:49Z")

</div>

I had a similar problem when deploying a CloudFront distribution with a S3 origin and creating a S3 Bucket Policy. I solved the problem by _not_ specifying the region and using the default us-east-1 region instead, as this is the region for global services.
