5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

CloudFormationでGlueジョブのジョブパラメーターを設定する方法

Posted at

CloudFormationでGlueジョブのジョブパラメーターを設定する方法

CloudFormationでGlueJobのジョブパラメータを設定する方法が分かりづらかったのでまとめ。

CloudFormationのGlueのYAMLでのテンプレートが以下のようにあったとして

template.yml
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31

  MyGlueJob:
    Type: AWS::Glue::Job
    Properties: 
        Name: my_glue_job
        Description: "My Glue Job"
        GlueVersion: "4.0"
        Command:
          Name: "glueetl"
          PythonVersion: "3"
          ScriptLocation: !Sub S3://my-glue-job/my_glue_job.py
        Role: !Ref MyGlueJobRole
        NumberOfWorkers: 1
        WorkerType: G.1X
        MaxRetries: 0
        Timeout: 5
        ExecutionProperty:
          MaxConcurrentRuns: 5   

オートスケーリング設定を追加したい場合は、
DefaultArguments:属性に--enable-auto-scaling: trueを追加する。

追加したテンプレートは以下のようになります。

template.yml
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31

  MyGlueJob:
    Type: AWS::Glue::Job
    Properties: 
        Name: my_glue_job
        Description: "My Glue Job"
        GlueVersion: "4.0"
        Command:
          Name: "glueetl"
          PythonVersion: "3"
          ScriptLocation: !Sub S3://my-glue-job/my_glue_job.py
        Role: !Ref MyGlueJobRole
        NumberOfWorkers: 1
        WorkerType: G.1X
        MaxRetries: 0
        Timeout: 5
        ExecutionProperty:
          MaxConcurrentRuns: 5
        DefaultArguments:
          --enable-auto-scaling: true 

Glueのジョブパラメータ。

よく使いそうな設定。

ジョブパラメータ 設定方法
--enable-auto-scaling: true:オートスケール設定
--enable-metrics: '':メトリクス有効
--enable-continuous-cloudwatch-log: true:ログ記録有効
--enable-glue-datacatalog: '':Spark が外部 Hive メタストアとしてData Catalog にアクセスできるようにする

--enable-metrics: や --enable-glue-datacatalog: は公式ドキュメントだと「trueに設定します」と書いてあるが実際は''で設定しないといけない。

Glueのジョブパラメータは以下で確認できます。

以上

5
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?