

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

# Amazon EventBridge에서 이벤트 JSON으로부터 스키마 생성
<a name="eb-schemas-infer-from-json"></a>

이벤트의 JSON이 있는 경우 해당 이벤트 유형에 대한 스키마를 자동으로 생성할 수 있습니다.

**이벤트의 JSON을 기반으로 스키마를 생성하려면**

1. [https://console.aws.amazon.com/events/](https://console.aws.amazon.com/events/)에서 Amazon EventBridge 콘솔을 엽니다.

1. 탐색 창에서 **스키마**를 선택한 다음, **스키마 생성**을 선택합니다.

1. (선택 사항) 스키마 레지스트리를 선택하거나 생성합니다.

1. **Schema details(스키마 세부 정보)**에서 스키마의 이름을 입력합니다.

1. (선택 사항) 생성한 스키마에 대한 설명을 입력합니다.

1. **스키마 유형**에는 **OpenAPI 3.0**을 선택합니다.

   이벤트의 JSON에서 스키마를 생성할 때는 JSONSchema를 사용할 수 없습니다.

1. **Discover from JSON(JSON에서 검색)**을 선택합니다.

1. **JSON** 아래의 텍스트 상자에서 이벤트의 JSON 소스를 붙여넣거나 끌어옵니다.

   예를 들어 실패한 실행에 대해이 AWS Step Functions 이벤트의 소스를 붙여 넣을 수 있습니다.

   ```
   {
       "version": "0",
       "id": "315c1398-40ff-a850-213b-158f73e60175",
       "detail-type": "Step Functions Execution Status Change",
       "source": "aws.states",
       "account": "012345678912",
       "time": "2019-02-26T19:42:21Z",
       "region": "us-east-1",
       "resources": [
         "arn:aws:states:us-east-1:012345678912:execution:state-machine-name:execution-name"
       ],
       "detail": {
           "executionArn": "arn:aws:states:us-east-1:012345678912:execution:state-machine-name:execution-name",
           "stateMachineArn": "arn:aws:states:us-east-1:012345678912:stateMachine:state-machine",
           "name": "execution-name",
           "status": "FAILED",
           "startDate": 1551225146847,
           "stopDate": 1551225151881,
           "input": "{}",
           "output": null
       }
   }
   ```

1. **Discover schema(스키마 발견)**를 선택합니다.

1. EventBridge는 이벤트에 대한 OpenAPI 스키마를 생성합니다. 예를 들어 이전 Step Functions 이벤트에 대해 다음 스키마가 생성됩니다.

   ```
   {
     "openapi": "3.0.0",
     "info": {
       "version": "1.0.0",
       "title": "StepFunctionsExecutionStatusChange"
     },
     "paths": {},
     "components": {
       "schemas": {
         "AWSEvent": {
           "type": "object",
           "required": ["detail-type", "resources", "detail", "id", "source", "time", "region", "version", "account"],
           "x-amazon-events-detail-type": "Step Functions Execution Status Change",
           "x-amazon-events-source": "aws.states",
           "properties": {
             "detail": {
               "$ref": "#/components/schemas/StepFunctionsExecutionStatusChange"
             },
             "account": {
               "type": "string"
             },
             "detail-type": {
               "type": "string"
             },
             "id": {
               "type": "string"
             },
             "region": {
               "type": "string"
             },
             "resources": {
               "type": "array",
               "items": {
                 "type": "string"
               }
             },
             "source": {
               "type": "string"
             },
             "time": {
               "type": "string",
               "format": "date-time"
             },
             "version": {
               "type": "string"
             }
           }
         },
         "StepFunctionsExecutionStatusChange": {
           "type": "object",
           "required": ["output", "input", "executionArn", "name", "stateMachineArn", "startDate", "stopDate", "status"],
           "properties": {
             "executionArn": {
               "type": "string"
             },
             "input": {
               "type": "string"
             },
             "name": {
               "type": "string"
             },
             "output": {},
             "startDate": {
               "type": "integer",
               "format": "int64"
             },
             "stateMachineArn": {
               "type": "string"
             },
             "status": {
               "type": "string"
             },
             "stopDate": {
               "type": "integer",
               "format": "int64"
             }
           }
         }
       }
     }
   }
   ```

1. 스키마가 생성된 후 **생성**을 선택합니다.