

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

# 작업 템플릿 파라미터 정의
<a name="use-job-template-parameters"></a>

작업 템플릿 파라미터를 사용하면 작업 템플릿에서 변수를 지정할 수 있습니다. 해당 작업 템플릿을 사용하여 작업 실행을 시작할 때 이러한 파라미터 값을 지정해야 합니다. Job 템플릿 파라미터는 `${parameterName}` 형식으로 지정됩니다. `jobTemplateData` 필드의 값을 작업 템플릿 파라미터로 지정하도록 선택할 수 있습니다. 각 작업 템플릿 파라미터 변수에 대해 해당 데이터 유형(`STRING` 또는 `NUMBER`)과 기본값(선택 사항)을 지정합니다. 아래 예제에서는 진입점 위치, 기본 클래스 및 S3 로그 위치 값에 대한 작업 템플릿 파라미터를 지정하는 방법을 보여줍니다.

**진입점 위치, 기본 클래스 및 Amazon S3 로그 위치를 작업 템플릿 파라미터로 지정하는 방법**

1. 다음 예제 JSON 파일에서 볼 수 있듯이 `create-job-template-request.json` 파일을 생성하고 작업 실행에 필요한 파라미터를 지정합니다. 파라미터에 대한 자세한 내용은 [CreateJobTemplate](https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/Welcome.html) API를 참조하세요.

   ```
   {
      "name": "mytemplate",
      "jobTemplateData": {
           "executionRoleArn": "iam_role_arn_for_job_execution", 
           "releaseLabel": "emr-6.7.0-latest",
           "jobDriver": {
               "sparkSubmitJobDriver": { 
                   "entryPoint": "${EntryPointLocation}",
                   "entryPointArguments": [ "argument1","argument2",...],
                   "sparkSubmitParameters": "--class ${MainClass} --conf spark.executor.instances=2 --conf spark.executor.memory=2G --conf spark.executor.cores=2 --conf spark.driver.cores=1"
               }
           },
           "configurationOverrides": {
               "applicationConfiguration": [
                   {
                       "classification": "spark-defaults", 
                       "properties": {
                            "spark.driver.memory":"2G"
                       }
                   }
               ], 
               "monitoringConfiguration": {
                   "persistentAppUI": "ENABLED", 
                   "cloudWatchMonitoringConfiguration": {
                       "logGroupName": "my_log_group", 
                       "logStreamNamePrefix": "log_stream_prefix"
                   }, 
                   "s3MonitoringConfiguration": {
                       "logUri": "${LogS3BucketUri}"
                   }
               }
           },
           "parameterConfiguration": {
               "EntryPointLocation": {
                   "type": "STRING"
               },
               "MainClass": {
                   "type": "STRING",
                   "defaultValue":"Main"
               },
               "LogS3BucketUri": {
                   "type": "STRING",
                   "defaultValue":"s3://my_s3_log_location/"
               }
           }
       }
   }
   ```

1. 로컬로 저장되었거나 Amazon S3에 저장된 `create-job-template-request.json` 파일 경로와 함께 `create-job-template` 명령을 사용합니다.

   ```
   aws emr-containers create-job-template \ 
   --cli-input-json file://./create-job-template-request.json
   ```

**작업 템플릿 파라미터가 포함된 작업 템플릿을 사용하여 작업을 시작하는 방법**

작업 템플릿 파라미터가 포함된 작업 템플릿으로 작업 실행을 시작하려면 아래와 같이 `StartJobRun` API 요청에서 작업 템플릿 ID와 작업 템플릿 파라미터 값을 지정합니다.

```
aws emr-containers start-job-run \
--virtual-cluster-id 123456 \
--name myjob \
--job-template-id 1234abcd \
--job-template-parameters '{"EntryPointLocation": "entry_point_location","MainClass": "ExampleMainClass","LogS3BucketUri": "s3://example_s3_bucket/"}'
```