-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtemplate.yaml
42 lines (39 loc) · 1.26 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
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Resources:
SaveItemMongoDBApiFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: SaveItemMongoDBApiFunction
CodeUri: src/Function/function.zip
Handler: mongodb_lambda.handler
Runtime: python3.7
MemorySize: 1024
Timeout: 30
Tracing: Active
Policies:
- AWSXrayWriteOnlyAccess
ReservedConcurrentExecutions: 10
VpcConfig:
SecurityGroupIds:
- sg-08b12e8bdf431b849
SubnetIds:
- subnet-08a19d1a47914c5ac
Environment:
Variables:
MONGODB_CONNECTION_STRING: mongodb+srv://<user>:<password>@<your-cluster>.mongodb.net/test?retryWrites=true&w=majority
DATABASE: yourDatabaseName
COLLECTION: yourCollectionName
Events:
ItemsApiPOSTitems:
Type: Api
Properties:
Path: /items
Method: POST
Outputs:
Api:
Description: "API Gateway endpoint URL"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/items"
SaveItemMongoDBApiFunction:
Description: "SaveItemMongoDBApiFunction Lambda Function ARN"
Value: !GetAtt SaveItemMongoDBApiFunction.Arn