-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
71 lines (65 loc) 路 1.66 KB
/
Copy pathserverless.yml
File metadata and controls
71 lines (65 loc) 路 1.66 KB
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
service: dailywikipediabot
package:
exclude:
- node_modules/**
- .idea/**
- .vscode/**
- .env
- README.md
- LICENSE
- package.json
- package-lock.json
- requirements.txt
custom:
appAcronym: dailywikipedia
dynamodbTable: dailywikipedia-${self:provider.stage}
dynamodbArn: arn:aws:dynamodb:${self:provider.region}:*:table/${self:custom.dynamodbTable}
dynamodbHost: https://dynamodb.${self:provider.region}.amazonaws.com
provider:
name: aws
runtime: python3.7
stage: ${opt:stage, 'dev'}
region: ${opt:region, 'eu-west-3'}
environment:
BOT_USERNAME: dailywikipediabot
TELEGRAM_TOKEN: ${env:TELEGRAM_TOKEN}
DYNAMODB_TABLE: ${self:custom.dynamodbTable}
DYNAMODB_HOST: ${self:custom.dynamodbHost}
REGION: ${self:provider.region}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- dynamodb:DescribeTable
Resource: ${self:custom.dynamodbArn}
functions:
bot:
handler: bot.handler
events:
- http: POST /
daily:
handler: bot.daily
events:
- schedule: cron(0 19 * * ? *)
plugins:
- serverless-python-requirements
resources:
Resources:
dailywikipediaTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.dynamodbTable}
AttributeDefinitions:
- AttributeName: id
AttributeType: N
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1