Use Case : Refer to an existing bucket while creating a S3 event for the Lambda function in SAM YAML file
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Sample SAM Template for sam-app
Globals:
Function:
Timeout: 900
MemorySize: 2048
Environment:
Variables:
TABLE_NAME: "111"
ENDPOINT_OVERRIDE: "222"
Resources:
SomePull:
Type: AWS::Serverless::Function
Properties:
CodeUri: target/demo-1.0.0.jar
Handler: com.xxxx.run.LambdaFunctionHandler::handleRequest
Runtime: java8
Role: arn:aws:iam::aaaa:roaaaale/aaaa/lambdaExecution
events:
bucket: codedeploytestxxx
event: s3:ObjectCreated:*
rules:
- prefix: uploads
- suffix: .jpg
existing: true
Reference : https://github.com/serverless/serverless/pull/6290
I tried couple of approaches , but still I am not able to refer to an existing bucket while creating an event , what configuration(s) I am missing from the above.
Error I get after executing the above script :
Invalid. property events not defined for resource of type AWS::Serverless::Function