# Trouble with SNS fanout pattern triggered by S3 event

**URL:** <https://forum.serverless.com/t/trouble-with-sns-fanout-pattern-triggered-by-s3-event/4196>\
**Category:** Serverless Framework\
**Created:** [April 7, 2018, 10:45pm UTC](https://forum.serverless.com/t/trouble-with-sns-fanout-pattern-triggered-by-s3-event/4196 "2018-04-07T22:45:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ffxsam](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/ffxsam/32/1655_2.png) [@ffxsam](https://forum.serverless.com/u/ffxsam)\
**Post date:** [April 7, 2018, 10:45pm UTC](https://forum.serverless.com/t/trouble-with-sns-fanout-pattern-triggered-by-s3-event/4196/1 "2018-04-07T22:45:11Z")

</div>

I’m trying to create a stack where I can upload a file to S3, which publishes to an SNS topic which calls two Lambda functions. I have a simple test:

```yaml
service:
  name: MyTest

# Add the serverless-webpack plugin
plugins:
  - serverless-webpack

custom:
  stage: $(opt:stage, self:provider.stage)
  topicName: SomeTopic
  topic: $(self:service)-$(self:custom.topicName)-$(self:custom.stage)
  topicArn:
    Fn::Sub: arn:aws:sns:$(self:provider.region):${AWS::AccountId}:$(self:custom.topic)

provider:
  name: aws
  runtime: nodejs8.10
  variableSyntax: '\$\(([\s\S]+?)\)'

functions:
  first:
    handler: first.hello
    events:
      - sns: $(self:custom.topic)
  second:
    handler: second.hello
    events:
      - sns: $(self:custom.topic)

resources:
  Resources:
    UploadBucket:
      Type: AWS::S3::Bucket
      DependsOn: SNSTopic$(self:service)$(self:custom.topicName)$(self:custom.stage)
      Properties:
        BucketName: aa-storage-test-vje8970
        NotificationConfiguration:
          TopicConfigurations:
            - Event: s3:ObjectCreated:Put
              Filter:
                S3Key:
                  Rules:
                    - Name: prefix
                      Value: staging/
              Topic: $(self:custom.topicArn)

```

Deploying this stack yields this error:

> Unable to validate the following destination configurations

It’s referring to the `aa-storage-test-vje8970` bucket. How do I build this out in Serverless? This is driving me insane, because I’m specifically having the bucket creation wait till the SNS topic has been created.
