【问题标题】:Capture Master public DNS when creating cluster via AWS CLI通过 AWS CLI 创建集群时捕获主公共 DNS
【发布时间】:2021-01-19 20:31:24
【问题描述】:
有没有办法在通过 CLI 创建 AWS EMR 集群后捕获其 master public DNS?我正在使用these scripts 来完成此操作。
第二个问题,可能超出 SO 准则,从命令行捕获变量然后编辑 bash 脚本的最佳实践是什么?我考虑过环境变量,但我的理解是自定义变量不会持续到 shell 会话之外。
谢谢!
【问题讨论】:
标签:
amazon-web-services
command-line
command-line-interface
aws-cli
【解决方案1】:
用于捕获 EMR 主公共 DNS:
- 等待集群进入运行状态:
aws emr wait cluster-running --cluster-id $ID
- 描述集群并获取主公共 DNS 名称:
MASTER_DNS=$(aws emr describe-cluster --cluster-id $ID --query 'Cluster.MasterPublicDnsName' --output text)
您可以将环境变量从一个脚本传递到另一个脚本或使用一些外部存储。 More details on sharing variables