forked from aws-samples/aws-lambda-hexagonal-architecture
/
template.yaml
58 lines (56 loc) · 1.47 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: hexagonal-arch-sample
Globals:
Function:
Timeout: 20
Resources:
StocksConverterFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: hexagonal-architecture/
Handler: app.lambdaHandler
Runtime: nodejs14.x
MemorySize: 256
# Role: lambdavpc_role_arn_insert_here
Policies:
- DynamoDBReadPolicy:
TableName: !Ref StocksTable
Environment:
Variables:
DB_TABLE: !Ref StocksTable
API_KEY: API_KEY_FOR_CURRENCIES_API
# CACHE_URL: aws_elasticache_url_insert_here
# CACHE_PORT: aws_elasticache_port_insert_here
# VpcConfig:
# SecurityGroupIds:
# - sg-d424b48a
# SubnetIds:
# - subnet-8459bbcf
# - subnet-c2c99598
Events:
StocksConverter:
Type: HttpApi
Properties:
ApiId: !Ref StocksGateway
Path: /stock/{StockID}
Method: get
StocksTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: STOCK_ID
AttributeType: S
KeySchema:
- AttributeName: STOCK_ID
KeyType: HASH
BillingMode: PAY_PER_REQUEST
StocksGateway:
Type: AWS::Serverless::HttpApi
Properties:
CorsConfiguration:
AllowMethods:
- GET
- POST
AllowOrigins:
- "*"