python - 如何在 python 脚本中执行 eksctl 命令?
问题描述
我想在 python 脚本中使用以下 eksctl 命令:
eksctl create -f managedcluster.yaml
我想知道此命令的 python 等效项,以便在运行 python 脚本时,创建托管集群。
解决方案
我认为创建 EKS 集群的最佳方法是使用 AWS Boto3 python 库https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/eks.html#EKS.Client.create_cluster。
但在您的情况下,最快的方法是使用子流程库。
前任 :
import subprocess
output = subprocess.check_output("eksctl create -f managedcluster.yaml", shell=True)
最好的,
推荐阅读
- machine-learning - 支持向量机有什么好处>
- arrays - React 对象中的嵌套数组
- sql - 已安装 unixODBC,但 odbcinst.ini 和 odbc.ini 为空
- typescript - 将方法绑定到插槽属性
- python - 用列表作为可用对象实例化一个类
- node.js - Microsoft Bot Builder - 向用户发送主动消息
- postgresql - 是否可以创建一个包含 ltree 字段的整个路径的唯一约束?
- java - 在类构造函数中使用枚举,类中的方法无法识别引用变量
- php - 将参数传递给可以在php中使用的ajax函数?
- android - 禁用 Button 直到所有 edittext 字段不为空且逻辑完成