-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathtemplate.yaml
49 lines (45 loc) · 1.33 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
MemorySize: 1024
Architectures: [arm64]
Runtime: dotnet8
Timeout: 30
Tracing: Active
Resources:
StocksConverterFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src/GetStock/
Handler: GetStock::GetStock.Functions::GetStockById
Policies:
- DynamoDBReadPolicy:
TableName: !Ref StockTable
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
DB_TABLE: !Ref StockTable
API_KEY: <Fixer API key>
BASE_API: https://api.apilayer.com/fixer/latest
Events:
Api:
Type: HttpApi
Properties:
Path: /stock/{StockId}
Method: GET
StockTable:
Type: AWS::Serverless::SimpleTable
Properties:
PrimaryKey:
Name: StockId
Type: String
ProvisionedThroughput:
ReadCapacityUnits: 2
WriteCapacityUnits: 2
Outputs:
ApiUrl:
Description: "API Gateway endpoint URL"
Value: !Sub "https://${ServerlessHttpApi}.execute-api.${AWS::Region}.amazonaws.com/"
TableName:
Description: "DynamoDB Table Name"
Value: !Ref StockTable