title: How to create S3 and triggered lambda in 2 different cloudformation templates
body: <p>Can a s3 bucket and triggered lambda be created in separate cloudformation templates. I want to keep long running resources stack separate from the likes of lambda which get updated quite frequently</p>
  
  <p>When tried to create lambda separately it says that bucket defined in lambda event should be defined in same template and cannot be referenced.</p>
  
  <pre><code>GetFileMetadata:
      Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
      Properties:
        FunctionName: !Sub '${targetenv}-lambdaname'
        CodeUri: target-file-0.0.1-SNAPSHOT.jar
        Handler: LambdaFunctionHandler::handleRequest
        Runtime: java8
        Timeout: 30
        MemorySize: 512
        Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
          Variables:
            STAGE: !Sub '${targetenv}'
  
        Events:
          S3Event:
            Type: S3
            Properties:
              Bucket:
                Ref: MyS3Bucket
              Events:
                - 's3:ObjectCreated:*'
  
    MyS3Bucket:
        Type: 'AWS::S3::Bucket'
        DependsOn: BucketPermission
        Properties:
            BucketName: !Sub 'bucketname-${targetenv}'
           # LifecycleConfiguration: 
            #  Rules:
             # - ExpirationInDays: 14
  </code></pre>