title: AWS CDK - How to add an event notification to an existing S3 Bucket
body: <p>I'm trying to modify <a href="https://github.com/aws-samples/aws-cdk-examples/blob/master/python/lambda-s3-trigger/s3trigger/s3trigger_stack.py" rel="noreferrer">this</a> AWS-provided CDK example to instead use an existing bucket. Additional <a href="https://docs.aws.amazon.com/cdk/latest/guide/resources.html#resources_importing" rel="noreferrer">documentation</a> indicates that importing existing resources is supported. So far I am unable to add an event notification to the existing bucket using CDK.</p>
  
  <p>Here is my modified version of the example: </p>
  
  <pre><code>class S3TriggerStack(core.Stack):
  
      def __init__(self, scope: core.Construct, id: str, **kwargs) -&gt; None:
          super().__init__(scope, id, **kwargs)
  
          # create lambda function
          function = _lambda.Function(self, "lambda_function",
                                      runtime=_lambda.Runtime.PYTHON_3_7,
                                      handler="lambda-handler.main",
                                      code=_lambda.Code.asset("./lambda"))
  
          # **MODIFIED TO GET EXISTING BUCKET**
          #s3 = _s3.Bucket(self, "s3bucket")
          s3 = _s3.Bucket.from_bucket_arn(self, 's3_bucket',
              bucket_arn='arn:&lt;my_region&gt;:::&lt;my_bucket&gt;')
  
          # create s3 notification for lambda function
          notification = aws_s3_notifications.LambdaDestination(function)
  
          # assign notification for the s3 event type (ex: OBJECT_CREATED)
          s3.add_event_notification(_s3.EventType.OBJECT_CREATED, notification)
  </code></pre>
  
  <p>This results in the following error when trying to <code>add_event_notification</code>:</p>
  
  <pre><code>AttributeError: '_IBucketProxy' object has no attribute 'add_event_notification'
  </code></pre>
  
  <p>The <code>from_bucket_arn</code> function returns an <code>IBucket</code>, and the <code>add_event_notification</code> function is a method of the <code>Bucket</code> class, but I can't seem to find any other way to do this. Maybe it's not supported. Any help would be appreciated.</p>