This repository has been archived by the owner on Aug 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
82 lines (82 loc) · 2.22 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
81
82
AWSTemplateFormatVersion: "2010-09-09"
Transform: "AWS::Serverless-2016-10-31"
Description: JSON API para consultar la Tasa Representativa del Mercado en la Superintendencia Financiera de Colombia.
Globals:
Api:
Cors:
AllowHeaders: "'Content-Type, Authorization, X-Amz-Date, X-Api-Key, X-Amz-Security-Token'"
AllowMethods: "'GET'"
AllowOrigin: "'*'"
MaxAge: "'600'"
Resources:
TrmTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: partition
AttributeType: N
- AttributeName: date
AttributeType: S
KeySchema:
- AttributeName: partition
KeyType: HASH
- AttributeName: date
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
StreamSpecification:
StreamViewType: NEW_IMAGE
Tags:
- Key: AppName
Value: !Ref AWS::StackName
DateApi:
Type: "AWS::Serverless::Function"
Properties:
Handler: handler.trm
Runtime: nodejs12.x
CodeUri: dist/
Description: Consulta el servicio web de la SFC y devuelve la información en formato JSON.
MemorySize: 128
Timeout: 5
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref TrmTable
Environment:
Variables:
TABLE_NAME: !Ref TrmTable
DEBUG: ""
STAGE: "Prod"
Events:
latest:
Type: Api
Properties:
Path: /latest
Method: GET
date:
Type: Api
Properties:
Path: /{date}
Method: GET
timeseries:
Type: Api
Properties:
Path: /timeseries
Method: GET
Tags:
AppName: !Ref AWS::StackName
Outputs:
DDBStream:
Description: DynamoDB Stream
Value: !GetAtt TrmTable.StreamArn
Export:
Name: !Sub "${AWS::StackName}-ddb-stream"
ApiUrl:
Description: Endpoint de API Gateway
Value: !Sub https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/
TrmTable:
Description: Tabla de DynamoDB
Value: !Ref TrmTable
DateApi:
Description: Función Lambda
Value: !Ref DateApi