如何通过 Terraform 在 AWS EMR 中添加自动缩放角色和规则

How to add autoscaling role and rules in AWS EMR via terraform

有没有人使用 terraform 在 AWS EMR 中成功实施自动缩放角色和规则? 我想要简单的 cpu 使用规则。 但不幸的是,我无法在生成的 EMR 中添加自动缩放角色。添加规则是下一步。

您不能向现有集群添加自动缩放角色。

When you create a cluster with an automatic scaling policy using the AWS CLI, you must first ensure that either the default IAM role exists, or that you have a custom IAM role with a policy attached that provides the appropriate permissions. To create the default role, you can run the create-default-roles command before you create a cluster.

You can then specify --auto-scaling-role EMR_AutoScaling_DefaultRole option when you create a cluster. Alternatively, you can create a custom automatic scaling role and then specify it when you create a cluster, for example --auto-scaling-role MyEMRAutoScalingRole.

请使用 Resource: aws_emr_cluster 的 autoscaling_policy 和 autoscaling_role 属性。

Automatic scaling in Amazon EMR requires an IAM role with permissions to add and terminate instances when scaling activities are triggered. A default role configured with the appropriate role policy and trust policy, EMR_AutoScaling_DefaultRole, is available for this purpose.