-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerated-template.yaml
82 lines (82 loc) · 2.04 KB
/
generated-template.yaml
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Hello world lambda with api gateway integration
Globals:
Function:
Runtime: python3.6
Timeout: 10
MemorySize: 128
Resources:
InputBucket:
Type: AWS::S3::Bucket
NeFileInfoQueue:
Type: AWS::SQS::Queue
FileDb:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: fileKey
AttributeType: S
KeySchema:
- AttributeName: fileKey
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
CatchNewFile:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://aws-sam-workshop-huuuge-dev/03a72d6fdc6a3bbab1a0604ab12195bd
Handler: publish_to_queue.lambda_handler
Policies:
- SQSSendMessagePolicy:
QueueName:
Fn::GetAtt:
- NeFileInfoQueue
- QueueName
Environment:
Variables:
SQS_URL:
Ref: NeFileInfoQueue
Events:
NewFileEvent:
Type: S3
Properties:
Bucket:
Ref: InputBucket
Events: s3:ObjectCreated:*
SaveFileInfoToDb:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://aws-sam-workshop-huuuge-dev/03a72d6fdc6a3bbab1a0604ab12195bd
Handler: pop_from_queue_and_save_to_db.lambda_handler
Policies:
- DynamoDBCrudPolicy:
TableName:
Ref: FileDb
Environment:
Variables:
DYNAMODB_NAME:
Ref: FileDb
Events:
SQSEvent:
Type: SQS
Properties:
Queue:
Fn::GetAtt:
- NeFileInfoQueue
- Arn
BatchSize: 1
Outputs:
FileDb:
Description: DynamoDb table name
Value:
Ref: FileDb
InputBucket:
Description: S3 Bucket for new files
Value:
Ref: InputBucket
NeFileInfoQueue:
Description: Queue with info about new files uploaded
Value:
Ref: NeFileInfoQueue