首页 > 解决方案 > 如何在 python 脚本中执行 eksctl 命令?

问题描述

我想在 python 脚本中使用以下 eksctl 命令:

eksctl create -f managedcluster.yaml

我想知道此命令的 python 等效项,以便在运行 python 脚本时,创建托管集群。

标签: pythonamazon-web-servicesamazon-ec2amazon-ekseksctl

解决方案


我认为创建 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)

最好的,


推荐阅读