ablog

不器用で落着きのない技術者のメモ

CloudFormation で EMR クラスター作成時に Bootstrap Action を実行する

CloudFormation で EMR クラスター作成時に Bootstrap Action を実行したメモ。

---
AWSTemplateFormatVersion: '2010-09-09'
Description: Main Template For Workshop

Parameters:

(中略)

  CFnS3Bucket:
    Description: Specify an Amazon S3 template URL
    Type: String
    Default: cfnBucket20181124

(中略)

  EMRStack:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: !Sub https://s3-ap-northeast-1.amazonaws.com/${CFnS3Bucket}/emr.yaml
      Parameters:

(中略)

        CFnS3Bucket: 
          Ref: CFnS3Bucket
AWSTemplateFormatVersion: '2010-09-09'
Description: Stack to create EMR Cluster.
Parameters:

(中略)

  CFnS3Bucket:
    Type: String
Resources:
  cluster:
    Type: AWS::EMR::Cluster
    Properties:

(中略)

      BootstrapActions:
        - Name: BootstrapAction
          ScriptBootstrapAction:
            Path: !Sub s3://${CFnS3Bucket}/emrBootstrapAction.sh
  • emrBootstrapAction.sh
#!/usr/bin/env bash

sudo wget http://www.congiu.net/hive-json-serde/1.3.6-SNAPSHOT/cdh5/json-serde-1.3.6-SNAPSHOT-jar-with-dependencies.jar -P /usr/lib/presto/plugin/hive-hadoop2/