-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
59 lines (54 loc) · 1.51 KB
/
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
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: telegram-geo-quiz-${!Ref Environment}
Parameters:
TelegramBotToken:
Type: String
Environment:
Type: String
Globals:
Function:
Timeout: 3
Resources:
TelegramGeoQuiz:
Type: AWS::Serverless::Function
Properties:
CodeUri: telegram-geo-quiz/
Handler: src/app.handler
Runtime: nodejs12.x
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref LocationTable
Environment:
Variables:
TELEGRAM_BOT_TOKEN: !Ref TelegramBotToken
LOCATION_TABLE_NAME: !Ref LocationTable
Events:
TelegramGeoQuiz:
Type: Api
Properties:
Path: /
Method: post
LocationTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: id
AttributeType: S
- AttributeName: location
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
- AttributeName: location
KeyType: RANGE
StreamSpecification:
StreamViewType: NEW_IMAGE
BillingMode: PAY_PER_REQUEST
Outputs:
TelegramGeoQuizApi:
Description: "API Gateway endpoint URL for Prod stage for Telegram Geo Quiz function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
LocationTableName:
Description: "Name of the DynamoDB database for the locations"
Value: !Ref LocationTable