1

I would like to use the following eksctl command in a python script :

eksctl create -f managedcluster.yaml

I would like to know the python equivalent of this command such that when the python script is run, then the managed cluster gets created.

Ali Baba
  • 85
  • 11
  • 1
    you can have a look at AWS boto3 [documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/eks.html#EKS.Client.create_cluster). – amitd Dec 22 '20 at 10:02
  • @amitd It involves creating the cluster manually. But I already have an eks cluster.yaml file that has to be deployed using the above command in python. – Ali Baba Dec 22 '20 at 10:17

1 Answers1

4

I think the best way to create an EKS cluster is using AWS Boto3 python library https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/eks.html#EKS.Client.create_cluster .

But the fastest way in your case is to use the subprocess library.

Ex :

import subprocess
output = subprocess.check_output("eksctl create -f managedcluster.yaml", shell=True)

Best,