

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 에서 EventBridge 스케줄러를 사용하여 시간 기반 이벤트 관리 AWS SAM
<a name="using-eventbridge-scheduler"></a>

이 주제의 내용은 Amazon EventBridge 스케줄러의 정의, 지원 AWS SAM 제안, 스케줄러 이벤트를 생성하는 방법 및 스케줄러 이벤트를 생성할 때 참조할 수 있는 예제에 대한 세부 정보를 제공합니다.

## Amazon EventBridge Scheduler란 무엇인가요?
<a name="using-eventbridge-scheduler-intro"></a>

EventBridge 스케줄러를 사용하여 AWS SAM 템플릿에서 이벤트를 예약합니다. Amazon EventBridge 스케줄러는 모든 서비스에서 수천만 개의 이벤트 및 작업을 생성, 시작 및 관리할 수 있는 예약 AWS 서비스입니다. 이 서비스는 시간 관련 이벤트에 특히 유용합니다. 이를 사용하여 이벤트 및 반복적인 시간 기반 호출을 예약할 수 있습니다. 또한 일회성 이벤트와 시작 및 종료 시간이 있는 비율 및 시간 표현식을 지원합니다.

Amazon EventBridge Scheduler에 대한 자세한 내용은 EventBridge Scheduler 사용 설명서**의 [Amazon EventBridge Scheduler란 무엇인가요?](https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html)를 참조하세요.

**Topics**
+ [Amazon EventBridge Scheduler란 무엇인가요?](#using-eventbridge-scheduler-intro)
+ [에서 EventBridge 스케줄러 지원 AWS SAM](#using-eventbridge-scheduler-sam-support)
+ [에서 EventBridge 스케줄러 이벤트 생성 AWS SAM](#using-eventbridge-scheduler-sam-create)
+ [예제](#using-eventbridge-scheduler-examples)
+ [자세히 알아보기](#using-eventbridge-scheduler-learn)

## 에서 EventBridge 스케줄러 지원 AWS SAM
<a name="using-eventbridge-scheduler-sam-support"></a>

 AWS Serverless Application Model (AWS SAM) 템플릿 사양은 AWS Lambda 및에 대해 EventBridge 스케줄러로 이벤트를 예약하는 데 사용할 수 있는 간단하고 간단한 구문을 제공합니다 AWS Step Functions.

## 에서 EventBridge 스케줄러 이벤트 생성 AWS SAM
<a name="using-eventbridge-scheduler-sam-create"></a>

`ScheduleV2` 속성을 AWS SAM 템플릿의 이벤트 유형으로 설정하여 EventBridge 스케줄러 이벤트를 정의합니다. 이 속성은 `AWS::Serverless::Function` 및 `AWS::Serverless::StateMachine` 리소스 유형을 지원합니다.

```
MyFunction:
  Type: AWS::Serverless::Function
  Properties:
    Events:
      CWSchedule:
        Type: ScheduleV2
        Properties:
          ScheduleExpression: 'rate(1 minute)'
          Name: TestScheduleV2Function
          Description: Test schedule event
                    
MyStateMachine:
  Type: AWS::Serverless::StateMachine
  Properties:
    Events:
      CWSchedule:
        Type: ScheduleV2
        Properties:
          ScheduleExpression: 'rate(1 minute)'
          Name: TestScheduleV2StateMachine
          Description: Test schedule event
```

EventBridge 스케줄러 이벤트 스케줄링은 처리되지 않은 이벤트에 대한 *DLQ(Dead Letter Queue)*도 지원합니다. dead-letter 대기열에 대한 자세한 내용은 *EventBridge 스케줄러 사용자 가이드*의 [EventBridge 스케줄러용 DLQ 대기열 구성](https://docs.aws.amazon.com/scheduler/latest/UserGuide/configuring-schedule-dlq.html)을 참조하세요.

DLQ ARN이 지정되면 스케줄러 일정에 대한 권한이 DLQ로 메시지를 전송하도록 AWS SAM 구성합니다. DLQ ARN을 지정하지 않으면가 DLQ 리소스를 AWS SAM 생성합니다.

## 예제
<a name="using-eventbridge-scheduler-examples"></a>

### 를 사용하여 EventBridge 스케줄러 이벤트를 정의하는 기본 예제 AWS SAM
<a name="using-eventbridge-scheduler-examples-example1"></a>

```
Transform: AWS::Serverless-2016-10-31
Resources:
  MyLambdaFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.handler
      Runtime: python3.8
      InlineCode: |
        def handler(event, context):
            print(event)
            return {'body': 'Hello World!', 'statusCode': 200}
      MemorySize: 128
      Events:
        Schedule:
          Type: ScheduleV2
          Properties:
            ScheduleExpression: rate(1 minute)
            Input: '{"hello": "simple"}'
 
  MySFNFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.handler
      Runtime: python3.8
      InlineCode: |
        def handler(event, context):
            print(event)
            return {'body': 'Hello World!', 'statusCode': 200}
      MemorySize: 128
 
  StateMachine:
    Type: AWS::Serverless::StateMachine
    Properties:
      Type: STANDARD
      Definition:
        StartAt: MyLambdaState
        States:
          MyLambdaState:
            Type: Task
            Resource: !GetAtt MySFNFunction.Arn
            End: true
      Policies:
        - LambdaInvokePolicy:
            FunctionName: !Ref MySFNFunction
      Events:
        Schedule:
          Type: ScheduleV2
          Properties:
            ScheduleExpression: rate(1 minute)
            Input: '{"hello": "simple"}'
```

## 자세히 알아보기
<a name="using-eventbridge-scheduler-learn"></a>

`ScheduleV2` EventBridge 스케줄러 속성을 정의하는 방법에 대한 자세한 내용은 다음을 참조하세요.
+ [ScheduleV2](sam-property-function-schedulev2.md)(`AWS::Serverless::Function`일 때)
+ [ScheduleV2](sam-property-statemachine-statemachineschedulev2.md)(`AWS::Serverless::StateMachine`일 때)