-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
80 lines (79 loc) · 2.39 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
75
76
77
78
79
80
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
quiz01-scraper-stk2 | test stack to try fastAPI
Globals:
Function:
Runtime: python3.10
Architectures:
- x86_64
Timeout: 3
Environment:
Variables:
API_TABLE_PYSICAL_ID: !Ref Quiz01Table
# API_TABLE_LOGICAL_NAME: QUIZ01TABLE
APP_NAME: quiz01-scraper
# API_LOGICAL_NAME: QUIZ01FASTAPI
# FOLDER_PATH: quiz01_api
WEB_PATH: quiz01
MY_STAGE: Prod
Resources:
Quiz01Table:
Type: AWS::DynamoDB::Table
Properties:
TableName: Questions
KeySchema:
- AttributeName: id
KeyType: HASH
- AttributeName: answer_text
KeyType: RANGE
AttributeDefinitions:
- AttributeName: id
AttributeType: S
- AttributeName: answer_text
AttributeType: S
ProvisionedThroughput:
ReadCapacityUnits: 10
WriteCapacityUnits: 5
# Quiz01Table:
# Type: AWS::Serverless::SimpleTable
# Properties:
# #TableName: QUIZ01TABLE
# PrimaryKey:
# Name: id
# # Name: question_text
# Type: String
Quiz01FastAPILambdaFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: app/
Handler: main.handler
# Handler: app.main.handler
Events:
MyEventSource01:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
RestApiId: !Ref Quiz01FastAPI
#Auth:
# ApiKeyRequired: true
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref Quiz01Table
Quiz01FastAPI:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
# Auth:
# ApiKeyRequired: true # sets for all methods
Outputs:
CreateQuestionAPI:
Description: "API Gateway endpoint url for creating items"
Value: !Sub "https://${Quiz01FastAPI}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
Quiz01FastAPILambdaFunction:
Description: "Quiz01 FastAPI Lambda Function ARN"
Value: !GetAtt Quiz01FastAPILambdaFunction.Arn
Quiz01FastAPILambdaFunctionIamRole:
Description: "Quiz01 FastAPI Lambda Function IAM Role ARN"
Value: !GetAtt Quiz01FastAPILambdaFunctionRole.Arn