# Serverless fails to create a S3 trigger for an existing S3 bucket

**URL:** <https://forum.serverless.com/t/serverless-fails-to-create-a-s3-trigger-for-an-existing-s3-bucket/15844>\
**Category:** Serverless Framework\
**Tags:** aws, cloudformation\
**Created:** [August 29, 2021, 1:33pm UTC](https://forum.serverless.com/t/serverless-fails-to-create-a-s3-trigger-for-an-existing-s3-bucket/15844 "2021-08-29T13:33:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![haiko](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/haiko/32/6147_2.png) [@haiko](https://forum.serverless.com/u/haiko)\
**Post date:** [August 29, 2021, 1:33pm UTC](https://forum.serverless.com/t/serverless-fails-to-create-a-s3-trigger-for-an-existing-s3-bucket/15844/1 "2021-08-29T13:33:07Z")

</div>

Deployment of my serverless app to trigger on S3 events fails to create a S3 trigger to the existing bucket. Below my serverless config. Any ideas what is wrong here? How can one debug this in the serverless framework?

serverless.yml:

```auto
...
provider:
  name: aws
  runtime: nodejs12.x
  memorySize: 128 # optional, in MB, default is 1024
  timeout: 10 # optional, in seconds, default is 6
  stage: ${opt:stage, 'dev'}
  region: eu-west-1
  iamRoleStatements:
    - Effect: Allow
      Action:
        - s3:*
      Resource: "*"

functions:
  s3EventProcessor:
    name: s3Importer-${opt:stage}
    handler: handler.processor
    events:
      - s3:
          bucket: upload-test
          event: s3:ObjectCreated:*
          rules:
            - suffix: .csv
          existing: true

```

---

<div class="post-metadata">

**Author:** ![buggy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buggy/32/177_2.png) [@buggy](https://forum.serverless.com/u/buggy)\
**Post date:** [August 30, 2021, 12:35am UTC](https://forum.serverless.com/t/serverless-fails-to-create-a-s3-trigger-for-an-existing-s3-bucket/15844/2 "2021-08-30T00:35:34Z")

</div>

Short answer - use [GitHub - mayconbordin/serverless-plugin-existing-s3](https://github.com/mayconbordin/serverless-plugin-existing-s3)

Long answer - you can’t do what you’re trying to do because S3 bucket triggers are configured as part of the S3 bucket resource in CloudFormation. This means you can only setup S3 bucket triggers if your Lambda and S3 bucket are deployed together. The Serverless framework hides this detail and makes it look like it’s the other direction.

---

<div class="post-metadata">

**Author:** ![haiko](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/haiko/32/6147_2.png) [@haiko](https://forum.serverless.com/u/haiko)\
**Post date:** [August 30, 2021, 8:16am UTC](https://forum.serverless.com/t/serverless-fails-to-create-a-s3-trigger-for-an-existing-s3-bucket/15844/3 "2021-08-30T08:16:25Z")

</div>

Thanks a lot! I just now let Serverless create the bucket and see that the trigger is created. Maybe someone from Serverless can update the docs to let people know using an existing bucket is not a viable option.

---

<div class="post-metadata">

**Author:** ![db42](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/db42/32/7470_2.png) [@db42](https://forum.serverless.com/u/db42)\
**Post date:** [May 16, 2023, 10:39am UTC](https://forum.serverless.com/t/serverless-fails-to-create-a-s3-trigger-for-an-existing-s3-bucket/15844/4 "2023-05-16T10:39:35Z")

</div>

This is supported now. Doc - [Serverless Framework - AWS Lambda Events - S3](https://www.serverless.com/framework/docs/providers/aws/events/s3)
