0

In AWS CloudShell I have a bash script file that we are using to run some commands inside an EKS cluster in the same region. Everytime I have to manually access the cloud shell and then run the bashscript. is there any automated way of doing this?

I am thinking to have an AWS Lambda that can access the cloudshell and run the script, But I cant find any information about how we can access cloudshell files using Lambda. Any help or suggestion on this? Thanks

Faisal Shani
  • 698
  • 1
  • 13
  • 37
  • AWS CloudShell "turns off" after a period of non-usage, otherwise you could have used `cron` to run a regular command. Perhaps you can find a way to trigger and run it _inside_ EKS? – John Rotenstein Jul 22 '22 at 23:16
  • @JohnRotenstein I just want to run this command inside EKS " kubectl rollout restart -n " But the thing is our EKS is using Role based access and you have to assume a specific role. I tried running this command inside a lambda after attaching the same role to Lambda but it is not working. any idea what I am doing wrong? – Faisal Shani Jul 22 '22 at 23:19

1 Answers1

0

Sadly you can't do this. CloudShell is only for an interactive work through browser.

Depending on what exactly do you want to do, you can run your script in lambda directly, or ECS task or even EC2 instance.

Marcin
  • 215,873
  • 14
  • 235
  • 294
  • I just want to run this command inside EKS " kubectl rollout restart -n " But the thing is our EKS is using Role based access and you have to assume a specific role. I tried running this command inside a lambda after attaching the same role to Lambda but it is not working. any idea what I am doing wrong? – Faisal Shani Jul 22 '22 at 23:20
  • @FaisalShani You have to make new question specific to your lambda issue. Provide it code, errors you get and more. – Marcin Jul 22 '22 at 23:20
  • here is the one which I asked yesterday https://stackoverflow.com/questions/73073284/execute-command-in-aws-eks-using-aws-lambda?noredirect=1#comment129075500_73073284 . Can you please have a look on this – Faisal Shani Jul 22 '22 at 23:21