This repository has been archived by the owner on Jan 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
74 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# S3 Metadata Eventhandler | ||
|
||
Redirect S3 Events to Sns. | ||
Use metadata as message attributes (see filtering with sns for more information) | ||
|
||
## Env | ||
|
||
```properties | ||
TOPIC_ARN=Topic where message will be redirected | ||
MANDATORY_META_DATA=S3 metadata which must exists otherwise an error will be raised and the message will not redirected. Comma seperated | ||
``` | ||
|
||
## Example | ||
|
||
```yaml | ||
|
||
ExampleRole: | ||
Properties: | ||
AssumeRolePolicyDocument: | ||
Statement: | ||
- Action: | ||
- sts:AssumeRole | ||
Effect: Allow | ||
Principal: | ||
Service: | ||
- lambda.amazonaws.com | ||
Policies: | ||
- PolicyDocument: | ||
Statement: | ||
- Action: | ||
- s3:GetObject | ||
Effect: Allow | ||
Resource: | ||
- "*" | ||
PolicyName: s3Policy | ||
- PolicyDocument: | ||
Statement: | ||
- Action: | ||
- sns:Publish | ||
Effect: Allow | ||
Resource: | ||
- !Sub 'arn:aws:sns:${AWS::Region}:${AWS::AccountId}:*' | ||
PolicyName: snsPolicy | ||
- PolicyDocument: | ||
Statement: | ||
- Action: | ||
- logs:CreateLogGroup | ||
- logs:CreateLogStream | ||
- logs:PutLogEvents | ||
Effect: Allow | ||
Resource: | ||
- '*' | ||
PolicyName: LogPolicy | ||
Type: AWS::IAM::Role | ||
|
||
ExampleTopic: | ||
Type: AWS::SNS::Topic | ||
Properties: | ||
DisplayName: ' exampleTopic' | ||
|
||
ExampleEventHandler: | ||
Type: AWS::Lambda::Function | ||
Properties: | ||
Code: | ||
... | ||
Environment: | ||
Variables: | ||
MANDATORY_META_DATA: api-key-id, pid, transcribe-provider | ||
TOPIC_ARN: !Ref 'ExampleTopic' | ||
Handler: index.handler | ||
Role: !GetAtt 'ExampleRole.Arn' | ||
Runtime: nodejs8.10 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters