-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
74 lines (68 loc) · 2.11 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
climbing-charts
Make charts of the capacity of climbing walls in London over time
Globals:
Function:
Timeout: 30
Api:
Cors:
AllowOrigin: "'*'"
Resources:
ClimbingScraperFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: climbing-scrape/
Handler: app.scrape_walls
Runtime: python3.8
Description: Scrape capacity info from the Lakeland Climbing Centre walls and stash it in DynamoDB
Policies:
- AmazonDynamoDBFullAccess
- AWSXRayDaemonWriteAccess
Tracing: Active
Events:
EveryFiveMinutes:
Type: Schedule
Properties:
Schedule: rate(5 minutes)
Name: every-five-minutes
Description: I mean, you run the thing every five minutes, how hard is it
Enabled: True
ClimbingDisplayFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: climbing-scrape/
Handler: app.load_from_dynamo
Runtime: python3.8
Description: Load and print scraped capacity info
Policies:
- AmazonDynamoDBFullAccess
- AWSXRayDaemonWriteAccess
Tracing: Active
Events:
DisplayClimbingCapacity:
Type: Api
Properties:
Path: /
Method: get
DynamoDBTable:
Type: AWS::Serverless::SimpleTable
Properties:
PrimaryKey:
Name: timestamp
Type: Number
TableName: climbing-capacity-info
Outputs:
ClimbingScraperFunction:
Description: "ClimbingScraperFunction Function ARN"
Value: !GetAtt ClimbingScraperFunction.Arn
SillyFunctionIamRole:
Description: "Implicit IAM Role created for my function"
Value: !GetAtt ClimbingScraperFunctionRole.Arn
DynamoDBTable:
Description: "I don't know what I'm doing this is a dynamodb table"
Value: !GetAtt DynamoDBTable.Arn
DisplayClimbingCapacityApi:
Description: "API Gateway endpoint URL for Prod stage for display function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/"