forked from marcy-terui/jeffy
-
Notifications
You must be signed in to change notification settings - Fork 10
/
serverless.yml
142 lines (138 loc) · 3.27 KB
/
serverless.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
service: jeffy
plugins:
- serverless-python-requirements
package:
exclude:
- node_modules/**
- .tox/**
provider:
name: aws
runtime: python3.8
region: ${opt:region, 'us-west-2'}
stage: ${opt:stage, 'dev'}
timeout: 30
environment:
FIREHOSE_NAME:
Ref: TestFirehose
iamRoleStatements:
- Effect: Allow
Action:
- "dynamodb:*"
- "sqs:*"
- "sns:*"
- "kinesis:*"
- "s3:*"
- "firehose:PutRecord"
Resource:
- "*"
functions:
StartTest:
handler: handler.start_test
environment:
API_URL:
Fn::Join: ["", [
"https://",
{ "Ref": "ApiGatewayRestApi" },
".execute-api.${self:provider.region}.amazonaws.com/${self:provider.stage}/test"
]]
TOPIC_ARN:
Ref: TestTopic
STREAM_NAME:
Ref: TestStream
QUEUE_URL:
Ref: TestQueue
TABLE_NAME:
Ref: TestTable
BUCKET_NAME: jeffy-s3-test
RestApiTest:
handler: handler.rest_api_test
events:
- http:
path: test
method: post
SnsTest:
handler: handler.sns_test
events:
- sns:
arn:
Ref: TestTopic
topicName: jeffy-sns-test
SqsTest:
handler: handler.sqs_test
events:
- sqs:
arn:
Fn::GetAtt: [TestQueue, Arn]
KinesisTest:
handler: handler.kinesis_test
events:
- stream:
type: kinesis
arn:
Fn::GetAtt: [TestStream, Arn]
DynamoTest:
handler: handler.dynamodb_test
events:
- stream:
type: dynamodb
arn:
Fn::GetAtt: [TestTable, StreamArn]
S3Test:
handler: handler.s3_test
events:
- s3:
bucket: jeffy-s3-test
# event: s3:ObjectCreated:*
event: s3:ObjectRemoved:*
resources:
Resources:
TestTopic:
Type: AWS::SNS::Topic
Properties:
TopicName: jeffy-sns-test
TestQueue:
Type: AWS::SQS::Queue
TestStream:
Type: AWS::Kinesis::Stream
Properties:
ShardCount: 1
TestTable:
Type: AWS::DynamoDB::Table
Properties:
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
StreamSpecification:
StreamViewType: NEW_AND_OLD_IMAGES
TestDeliveryRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: ''
Effect: Allow
Principal:
Service: firehose.amazonaws.com
Action: 'sts:AssumeRole'
Condition:
StringEquals:
'sts:ExternalId':
Ref: 'AWS::AccountId'
TestFirehose:
Type: AWS::KinesisFirehose::DeliveryStream
Properties:
DeliveryStreamType: DirectPut
ExtendedS3DestinationConfiguration:
RoleARN:
Fn::GetAtt: [TestDeliveryRole, Arn]
BucketARN: 'arn:aws:s3:::jeffy-s3-test'
Prefix: firehose/
CompressionFormat: UNCOMPRESSED
BufferingHints:
IntervalInSeconds: 60
SizeInMBs: 1