forked from amazon-archives/aws-serverless-sns-forwarder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yml
71 lines (65 loc) · 2.24 KB
/
template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A lambda function that forwards messages to an SNS topic
Metadata:
AWS::ServerlessRepo::Application:
Name: aws-serverless-sns-forwarder
Description: This is a serverless app that receives a JSON array of strings and forwards them to a SNS topic.
Author: AWS
# SPDX License Id, e.g., MIT, MIT-0, Apache-2.0. See https://spdx.org/licenses for more details
SpdxLicenseId: MIT
# paths are relative to .aws-sam/build directory
LicenseUrl: ../../LICENSE
ReadmeUrl: ../../README.md
Labels: [serverless,sns,lambda]
HomePageUrl: https://github.com/awslabs/aws-serverless-sns-forwarder
# Update the semantic version and run sam publish to publish a new version of your app
SemanticVersion: 0.0.1
# best practice is to use git tags for each release and link to the version tag as your source code URL
SourceCodeUrl: https://github.com/awslabs/aws-serverless-sns-forwarder/tree/0.0.1
Parameters:
LogLevel:
Type: String
Description: Log level for Lambda function logging, e.g., ERROR, INFO, DEBUG, etc
Default: INFO
SnsTopicName:
Type: String
Description: Sns Topic Name
Globals:
Function:
Runtime: python3.7
Tracing: Active
Timeout: 60
MemorySize: 256
DeadLetterQueue:
Type: SQS
TargetArn:
Fn::GetAtt:
- SnsForwarderFunctionDLQ
- Arn
Resources:
SnsForwarderFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: src/
Handler: handlers.forward_sns
Environment:
Variables:
LOG_LEVEL: !Ref LogLevel
TOPIC_ARN: !Sub arn:${AWS::Partition}:sns:${AWS::Region}:${AWS::AccountId}:${SnsTopicName}
Policies:
-
SNSPublishMessagePolicy:
TopicName: !Ref SnsTopicName
SnsForwarderFunctionDLQ:
Type: AWS::SQS::Queue
Outputs:
SnsForwarderFunctionName:
Description: "Sns Forwarder Lambda Function Name"
Value: !Ref SnsForwarderFunction
SnsForwarderFunctionArn:
Description: "Sns Forwarder Lambda Function ARN"
Value: !GetAtt SnsForwarderFunction.Arn
SnsForwarderFunctionDLQArn:
Description: "DLQ ARN"
Value: !GetAtt SnsForwarderFunctionDLQ.Arn