The cfn-lambda-s3-bucket-notification-configuration
function is CloudFormation Custom Lambda that support of create s3 bucket notification configuration
See also official documentation.
- Declare notifications independently of
AWS::S3::Bucket
The function replace all notifications if you created it. You must be created notifications with this resource(function) only.
S3Bucket:
Type: AWS::S3::Bucket
S3BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref S3Bucket
PolicyDocument:
Statement:
- Action:
- "s3:PutBucketNotification"
Effect: "Allow"
Resource: !GetAtt S3Bucket.Arn
Principal:
AWS: !ImportValue cfn-lambda-s3-bucket-notification-configuration:LambdaRoleArn
S3BucketNofiticationConfiguration:
Type: Custom::Lambda
DependsOn: S3BucketPolicy
Properties:
ServiceToken: !ImportValue cfn-lambda-s3-bucket-notification-configuration:LambdaArn
Bucket: !Ref S3Bucket
NotificationConfiguration:
LambdaFunctionConfigurations:
- Events:
- s3:ObjectCreated:*
LambdaFunctionArn: !GetAtt LambdaFunction.Arn
DeployAlways: !Ref Date
Policies:
Deletion:
- IgnoreError
The function implements s3api put-bucket-notification-configuration
- BucketName
- Required: Yes
- Update requires: Replacement
- Docs
- Required: Yes
- Update requires: No interruption
- Support values are
IgnoreError
andRetain
.IgnoreError
- Required: No
- Update requires: No interruption