code: def create_s3_event(app_name, env, region, bucket, triggers):
      
      session = boto3.Session(profile_name=env, region_name=region)
      s3_client = session.client('s3')
  
      lambda_alias_arn = get_lambda_alias_arn(app_name, env, region)
  
      LOG.debug("Lambda ARN for lambda function %s is %s.", app_name, lambda_alias_arn)
      LOG.debug("Creating S3 events for bucket %s", bucket)
  
      # allow lambda trigger permission from bucket
      principal = 's3.amazonaws.com'
      statement_id = "{}_s3_{}".format(app_name, bucket).replace('.', '')
      source_arn = "arn:aws:s3:::{}".format(bucket)
      add_lambda_permissions(
          function=lambda_alias_arn,
          env=env,
          region=region,
          principal=principal,
          statement_id=statement_id,
          source_arn=source_arn)
  
      # configure events on s3 bucket to trigger lambda function
      template_kwargs = {"lambda_arn": lambda_alias_arn, "triggers": triggers}
      config = get_template(template_file='infrastructure/lambda/s3_event.json.j2', **template_kwargs)
      s3_client.put_bucket_notification_configuration(Bucket=bucket, NotificationConfiguration=json.loads(config))
  
      LOG.info("Created lambda %s S3 event on bucket %s", app_name, bucket)
docs: Create S3 lambda events from triggers
  
      Args:
          app_name (str): name of the lambda function
          env (str): Environment/Account for lambda function
          region (str): AWS region of the lambda function
          triggers (list): List of triggers from the settings