AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门。
使用 CLI 启动与 Lake Formation 集成的 Amazon EMR 集群
以下过程演示了如何启动 Amazon EMR 集群,其中带有与 AWS Lake Formation 集成的 Zeppelin。
-
为安全配置创建一个
security-configuration.json
文件,其中包含以下内容。-
指定在 S3 中上传的 IdP 元数据文件的完整路径。
-
将
account-id
替换为您的 AWS 账户 ID。 -
为
TicketLifetimeInHours
指定一个值,用于确定 KDC 发放的 Kerberos 票证的有效期间。
{ "LakeFormationConfiguration": { "IdpMetadataS3Path": "s3://
mybucket/myfolder/idpmetadata.xml
", "EmrRoleForUsersARN": "arn:aws:iam::account-id
:role/IAM_Role_For_AWS_Services
", "LakeFormationRoleForSAMLPrincipalARN": "arn:aws:iam::account-id
:role/IAM_Role_For_Lake_Formation
" }, "AuthenticationConfiguration": { "KerberosConfiguration": { "Provider": "ClusterDedicatedKdc", "ClusterDedicatedKdcConfiguration": { "TicketLifetimeInHours":24
} } } } -
-
运行以下命令以创建安全配置。
aws emr create-security-configuration \ --security-configuration file://./security-configuration.json \ --name security-configuration
-
创建配置 Hive Metastore 的
configurations.json
文件。[ { "Classification": "spark-hive-site", "Properties": { "hive.metastore.glue.catalogid": "
account-id
" } } ] -
运行以下命令来启动 Amazon EMR 集群。
-
将
subnet-00xxxxxxxxxxxxx11
替换为您的子网 ID。 -
将
EC2_KEY_PAIR
替换为您用于此集群的 EC2 密钥对的名称。EC2 密钥对是可选的,仅当您希望使用 SSH 访问集群时是必需的。 -
将
cluster-name
替换为您集群的名称。
aws emr create-cluster --region us-east-1 \ --release-label emr-5.26.0 \ --use-default-roles \ --instance-groups InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m4.xlarge \ InstanceGroupType=CORE,InstanceCount=1,InstanceType=m4.xlarge \ --applications Name=Zeppelin Name=Livy \ --kerberos-attributes Realm=EC2.INTERNAL,KdcAdminPassword=
MyClusterKDCAdminPassword
\ --configurations file://confugurations.json \ --ec2-attributes KeyName=EC2_KEY_PAIR
,SubnetId=subnet-00xxxxxxxxxxxxx11
\ --security-configuration security-configuration \ --namecluster-name
-