-
Notifications
You must be signed in to change notification settings - Fork 38
/
template.native.yaml
108 lines (100 loc) · 2.77 KB
/
template.native.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
lambda-springboot-sample
Sample SAM Template for lambda-springboot
Globals:
Function:
Tracing: Active
CodeUri: target/function-native-zip.zip
Handler: org.springframework.cloud.function.adapter.aws.FunctionInvoker::handleRequest
Runtime: provided
Timeout: 30
MemorySize: 1024
Environment:
Variables:
PRODUCT_TABLE_NAME: !Ref ProductsTable
Resources:
MyApi:
Type: AWS::Serverless::Api
Properties:
StageName: prod
Name: My Lambda springboot GraalVM Sample API
GetProductByIdFunction:
Type: AWS::Serverless::Function
Properties:
Environment:
Variables:
SPRING_CLOUD_FUNCTION_DEFINITION: getProductByIdFunction
Policies:
- DynamoDBReadPolicy:
TableName: !Ref ProductsTable
Events:
GetRequestById:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /products/{id}
Method: get
GetProductsFunction:
Type: AWS::Serverless::Function
Properties:
Environment:
Variables:
SPRING_CLOUD_FUNCTION_DEFINITION: getAllProductsFunction
Policies:
- DynamoDBReadPolicy:
TableName: !Ref ProductsTable
Events:
GetRequest:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /products
Method: get
PutProductFunction:
Type: AWS::Serverless::Function
Properties:
Environment:
Variables:
SPRING_CLOUD_FUNCTION_DEFINITION: createProductFunction
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref ProductsTable
Events:
PutRequest:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /products/{id}
Method: put
DeleteProductFunction:
Type: AWS::Serverless::Function
Properties:
Environment:
Variables:
SPRING_CLOUD_FUNCTION_DEFINITION: deleteProductFunction
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref ProductsTable
Events:
PutRequest:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /products/{id}
Method: delete
ProductsTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: 'PK'
AttributeType: 'S'
KeySchema:
- AttributeName: 'PK'
KeyType: 'HASH'
BillingMode: PAY_PER_REQUEST
Outputs:
ApiEndpoint:
Description: "API Gateway endpoint URL for Prod stage for Springboot sample function"
Value: !Sub "https://${MyApi}.execute-api.${AWS::Region}.amazonaws.com/prod/products"