· 5 years ago · Jun 15, 2020, 01:16 PM
1AWSTemplateFormatVersion: '2010-09-09'
2Transform: AWS::Serverless-2016-10-31
3Description: >
4 marketplace-api
5
6 Sample SAM Template for marketplace-api
7
8# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
9Globals:
10 Function:
11 Timeout: 3
12
13Resources:
14 MarketplaceApiGateway:
15 Type: AWS::Serverless::Api
16 Properties:
17 StageName: stage
18 HelloWorldFunction:
19 Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
20 Properties:
21 CodeUri: hello_world/
22 Handler: app.lambda_handler
23 Runtime: python3.7
24 Events:
25 HelloWorld:
26 Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
27 Properties:
28 Path: /hello
29 Method: get
30 Ref: MarketplaceApiGateway
31 GoodbyeWorldFunction:
32 Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
33 Properties:
34 CodeUri: goodbye_world/
35 Handler: app.lambda_handler
36 Runtime: python3.7
37 Events:
38 GoodbyeWorld:
39 Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
40 Properties:
41 Path: /goodbye
42 Method: get
43 Ref: MarketplaceApiGateway
44
45
46Outputs:
47 # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
48 # Find out more about other implicit resources you can reference within SAM
49 # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
50 HelloWorldApi:
51 Description: "API Gateway endpoint URL for Prod stage for Hello World function"
52 Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
53 HelloWorldFunction:
54 Description: "Hello World Lambda Function ARN"
55 Value: !GetAtt HelloWorldFunction.Arn
56 HelloWorldFunctionIamRole:
57 Description: "Implicit IAM Role created for Hello World function"
58 Value: !GetAtt HelloWorldFunctionRole.Arn
59 GoodbyeWorldApi:
60 Description: "API Gateway endpoint URL for Prod stage for Goodbye World function"
61 Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/goodbye/"
62 GoodbyeWorldFunction:
63 Description: "Goodbye World Lambda Function ARN"
64 Value: !GetAtt GoodbyeWorldFunction.Arn
65 GoodbyeWorldFunctionIamRole:
66 Description: "Implicit IAM Role created for Goodbye World function"
67 Value: !GetAtt GoodbyeWorldFunctionRole.Arn