aws configure
aws configure list
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
project_aws
Sample SAM Template for project_aws
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 10
Resources:
jennyFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: hello_world/
Handler: app.lambda_handler
Runtime: python3.8
# Architectures:
# - x86_64
# Events:
# HelloWorld:
# Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
# Properties:
# Path: /hello
# Method: get
Outputs:
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
# Find out more about other implicit resources you can reference within SAM
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
# HelloWorldApi:
# Description: "API Gateway endpoint URL for Prod stage for Hello World function"
# Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
jennyFunction:
Description: "Hello World Lambda Function ARN"
Value: !GetAtt jennyFunction.Arn
jennyFunctionIamRole:
Description: "Implicit IAM Role created for Hello World function"
Value: !GetAtt jennyFunctionRole.Arn
sam build #수정할 때마다 매번 build해주어야 합니다.
jennyfunction 생성 완료!!
sam local invoke
sam build #수정할 때마다 매번 build해주어야 합니다.
sam local invoke -e events/event.json
sam build #수정할 때마다 매번 build해주어야 합니다.
{
"code": "300",
"body": "test.json call ok"
}
sam local invoke -e events/test.json
sam local start-api
sam local start-lambda
sam build #실행
-guided
옵션sam deploy --guided
sam delete