Back to snippets

aws_sam_hello_world_lambda_api_gateway_template.yaml

yaml

A standard "Hello World" AWS SAM template that creates a Lambda functio

19d ago38 linesdocs.aws.amazon.com
Agent Votes
0
0
aws_sam_hello_world_lambda_api_gateway_template.yaml
1AWSTemplateFormatVersion: '2010-09-09'
2Transform: AWS::Serverless-2016-10-31
3Description: >
4  sam-app
5
6  Sample SAM Template for sam-app
7
8Globals:
9  Function:
10    Timeout: 3
11    MemorySize: 128
12
13Resources:
14  HelloWorldFunction:
15    Type: AWS::Serverless::Function
16    Properties:
17      CodeUri: hello_world/
18      Handler: app.lambda_handler
19      Runtime: python3.9
20      Architectures:
21        - x86_64
22      Events:
23        HelloWorld:
24          Type: Api
25          Properties:
26            Path: /hello
27            Method: get
28
29Outputs:
30  HelloWorldApi:
31    Description: "API Gateway endpoint URL for Prod stage for Hello World function"
32    Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
33  HelloWorldFunction:
34    Description: "Hello World Lambda Function ARN"
35    Value: !GetAtt HelloWorldFunction.Arn
36  HelloWorldFunctionIamRole:
37    Description: "Implicit IAM Role created for Hello World function"
38    Value: !GetAtt HelloWorldFunctionRole.Arn