1. template.yaml 파일 수정
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
test description
# Global 설정 Layer선언 부분
Globals:
Function:
Timeout: 3
# 람다 함수 관련 부분
Resources:
# 대표이름, sam build시 해당 이름으로 폴더가 생성됨
HelloWorld:
Type: AWS::Serverless::Function
Properties:
# 해당 폴더가 있는 URL ( ex. myPycharmProject/sam-app/hello_world/app.py )
CodeUri: hello_world/
# 함수명, Lambda에서 보여질 이름
FunctionName: test_hello_world
Handler: app.lambda_handler
Runtime: python3.9
Architectures:
- x86_64
# AWS IAM Role. 관련 Role이 없다면 sam delploy -g 를 통해 배포 시 자동생성
Role: 'arn:aws:iam::123123123:role/lambdaEtlRole'
# #Web Api, S3 Trigger 등 Event 선언 부분
# Events:
# HelloWorld:
# Type: Api
# Properties:
# Path: /hello
# Method: get
# 한 프로젝트에 여러 Lambda 함수를 정의하고 싶을 때 이어서 쓰면 된다.
HelloWorld_2:
Type: AWS::Serverless::Function
Properties:
CodeUri: hello_world_2/
FunctionName: hello_world_2
Handler: app.lambda_handler
Runtime: python3.9
.....
2. Edit Configurations
a. 최상단의 Run/Debug 종류를 고르는 select box에서 edit configurations를 클릭

b. 위 이미지의 좌측 상단에 '+'를 클릭해 AWS Lambda 선택
c. from template 선택 -> template.yaml 지정 -> 함수 지정 -> input 데이터 지정
d. Apply 후 Ok, Run 실행
3. Local Debugging
braekpoint를 찍어 디버깅이 잘 되는지 확인

'Platform > AWS' 카테고리의 다른 글
AWS - Glue Notebook 개발환경 설정 (0) | 2023.03.26 |
---|---|
AWS - SAM을 통한 Lambda [3]Layer with Pycharm (0) | 2023.03.26 |
AWS - SAM을 통한 Lambda [1]Pycharm 환경 셋팅 (0) | 2023.03.26 |
AWS - Glue와 SageMaker와 사용 시 Spark Session 차이 (0) | 2023.03.26 |
AWS - CloudWatch로 경보알림 설정 (0) | 2023.03.25 |