简体   繁体   English

是否可以通过提供json文件中的所有配置在EMR中创建集群

[英]Is it possible to create cluster in EMR by giving all the configurations from json file

I want to automate the cluster creation task in EMR. 我想自动化EMR中的集群创建任务。 I have a json file which contains configurations which need to be applied on new cluster and I want to write a shell script which automates this task for me. 我有一个json文件,其中包含需要在新集群上应用的配置,并且我想编写一个shell脚本来自动执行此任务。

Is it possible to create cluster in EMR by giving all the configurations from json file? 通过提供json文件中的所有配置,是否有可能在EMR中创建集群?

For example I have this file 例如我有这个文件

{
"Cluster": { 
    "Ec2InstanceAttributes": {
        "EmrManagedMasterSecurityGroup": "sg-00b10b71", 
        "RequestedEc2AvailabilityZones": [], 
        "AdditionalSlaveSecurityGroups": [], 
        "AdditionalMasterSecurityGroups": [], 
        "RequestedEc2SubnetIds": [
            "subnet-02291b3e"
        ], 
        "Ec2SubnetId": "subnet-02291b3e", 
        "IamInstanceProfile": "EMR_EC2_DefaultRole", 
        "Ec2KeyName": "perf_key_pair", 
        "Ec2AvailabilityZone": "us-east-1e", 
        "EmrManagedSlaveSecurityGroup": "sg-f2b30983"
    }, 
    "Name": "NitinJ-Perf", 
    "ServiceRole": "EMR_DefaultRole", 
    "Tags": [
        {
            "Value": "Perf-Nitink", 
            "Key": "Qubole"
        }
    ], 
    "Applications": [
        {
            "Version": "3.7.2", 
            "Name": "Ganglia"
        }, 
        {
            "Version": "2.7.3", 
            "Name": "Hadoop"
        }, 
        {
            "Version": "2.1.1", 
            "Name": "Hive"
        }, 
        {
            "Version": "0.16.0", 
            "Name": "Pig"
        }, 
        {
            "Version": "0.8.4", 
            "Name": "Tez"
        }
    ], 
    "MasterPublicDnsName": "ec2-34-229-254-217.compute-1.amazonaws.com", 
    "ScaleDownBehavior": "TERMINATE_AT_INSTANCE_HOUR", 
    "InstanceGroups": [
        {
            "RequestedInstanceCount": 4, 
            "Status": {
                "Timeline": {
                    "ReadyDateTime": 1499150835.979, 
                    "CreationDateTime": 1499150533.99
                }, 
                "State": "RUNNING", 
                "StateChangeReason": {
                    "Message": ""
                }
            }, 
            "Name": "Core Instance Group", 
            "InstanceGroupType": "CORE", 
            "EbsBlockDevices": [], 
            "ShrinkPolicy": {}, 
            "Id": "ig-34P3CVF8ZL5CW", 
            "Configurations": [], 
            "InstanceType": "r3.4xlarge", 
            "Market": "ON_DEMAND", 
            "RunningInstanceCount": 4
        }, 
        {
            "RequestedInstanceCount": 1, 
            "Status": {
                "Timeline": {
                    "ReadyDateTime": 1499150804.591, 
                    "CreationDateTime": 1499150533.99
                }, 
                "State": "RUNNING", 
                "StateChangeReason": {
                    "Message": ""
                }
            }, 
            "Name": "Master Instance Group", 
            "InstanceGroupType": "MASTER", 
            "EbsBlockDevices": [], 
            "ShrinkPolicy": {}, 
            "Id": "ig-3V7EHQ36187PY", 
            "Configurations": [], 
            "InstanceType": "r3.4xlarge", 
            "Market": "ON_DEMAND", 
            "RunningInstanceCount": 1
        }
    ], 
    "Configurations": [
        {
            "Properties": {
                "hive.vectorized.execution.enabled": "true"
            }, 
            "Classification": "hive-site"
        }
    ]
}
}

Can I create a cluster on EMR by using some command like 我可以使用以下命令在EMR上创建集群吗?

aws emr create-cluster --cli-input-json file://'pwd'/emr_cluster_up.json

There is no such option through the AWS CLI as per the AWS CLI documentation. 根据AWS CLI文档,通过AWS CLI没有此类选项。 But if you want to automate the EMR cluster creation using a JSON file. 但是,如果要使用JSON文件自动创建EMR集群。 You can use Cloud formation and automate the cluster creation. 您可以使用云形成并自动创建集群。

Getting Started with AWS CloudFormation AWS CloudFormation入门

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM