# AWS S3 with event: Unable to validate the following destination configurations

**URL:** <https://forum.serverless.com/t/aws-s3-with-event-unable-to-validate-the-following-destination-configurations/9449>\
**Category:** Serverless Framework\
**Tags:** aws, lambda\
**Created:** [September 25, 2019, 8:46pm UTC](https://forum.serverless.com/t/aws-s3-with-event-unable-to-validate-the-following-destination-configurations/9449 "2019-09-25T20:46:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rino](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/rino/32/3646_2.png) [@Rino](https://forum.serverless.com/u/Rino)\
**Post date:** [September 25, 2019, 8:46pm UTC](https://forum.serverless.com/t/aws-s3-with-event-unable-to-validate-the-following-destination-configurations/9449/1 "2019-09-25T20:46:10Z")

</div>

Hi,

when i deploy my image resizing code with:  
`sls deploy --stage acc --bucket mybucketname --verbose`

I get:  
`CloudFormation - CREATE_FAILED - Custom::S3 - ImageResizeCustomS31`  
…  
`An error occurred: ImageResizeCustomS31 - Failed to create resource. Unable to validate the following destination configurations`

**This is my serverless.yml**

```auto
service: myproject-image-service
custom:
  uploadFolder: uploads/

provider:
  name: aws
  runtime: nodejs10.x
  region: eu-west-1
  iamRoleStatements:
    - Effect: Allow
      Action:
        - s3:*
      Resource: 'arn:aws:s3:::${opt:bucket}/*'

functions:
  imageResize:
    handler: resizeImageHandler.resize
    environment:
      BUCKET: ${opt:bucket}
      UPLOAD_FOLDER: ${self:custom.uploadFolder}
    events:
      - s3:
          bucket: ${opt:bucket}
          event: s3:ObjectCreated:*
          existing: true
          rules:
            - prefix: ${self:custom.uploadFolder}`

```

Note: when i remove the events part, it works. Seems to be a timing issue? but how do i solve this?

---

<div class="post-metadata">

**Author:** ![KrustyHack](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/krustyhack/32/4315_2.png) [@KrustyHack](https://forum.serverless.com/u/KrustyHack)\
**Post date:** [June 7, 2020, 7:07pm UTC](https://forum.serverless.com/t/aws-s3-with-event-unable-to-validate-the-following-destination-configurations/9449/2 "2020-06-07T19:07:34Z")

</div>

Ay,

I got the same error with my S3 events block.

Did you find a solution ?

EDIT : I found the solution in Github. You need to delete your events and recreate them. I did that and now it works fine. I hope it can help. 🙂

Here is my code :

```
service: ultima-api
# app and org for use with dashboard.serverless.com
app: ultima-api
org: xxx

# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=X.X.X"

provider:
  name: aws
  runtime: nodejs12.x
  stage: ${opt:stage, 'dev'}
  region: us-east-1

  memorySize: 512
  timeout: 180

  iamManagedPolicies:
    - "arn:aws:iam::xxx:policy/BcnUltima"

  environment:
    TEST: ${self:custom.${self:provider.stage}.s3-temp-bucket}

functions:
  onS3UnzipToS3:
    handler: src/handler.onS3UnzipToS3
    events:
      - s3:
          bucket: ${self:custom.${self:provider.stage}.s3-temp-bucket}
          existing: true

plugins:
  - serverless-plugin-typescript
  - serverless-offline

custom:
  prod:
    s3-temp-bucket: mybucket-prod
  dev:
    s3-temp-bucket: mybucket-dev
```

---

<div class="post-metadata">

**Author:** ![robertu7](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/robertu7/32/4336_2.png) [@robertu7](https://forum.serverless.com/u/robertu7)\
**Post date:** [June 16, 2020, 10:25am UTC](https://forum.serverless.com/t/aws-s3-with-event-unable-to-validate-the-following-destination-configurations/9449/3 "2020-06-16T10:25:40Z")

</div>

Nice, it works!

In case anybody doesn’t know how to delete S3 events, please jump to [https://docs.aws.amazon.com/AmazonS3/latest/user-guide/enable-event-notifications.html](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/enable-event-notifications.html) for details.
