trek10inc / awsume

A utility for easily assuming AWS IAM roles from the command line.
https://awsu.me
MIT License
487 stars 90 forks source link

Support for an exec like flag. #135

Open netguino opened 3 years ago

netguino commented 3 years ago

It would be great if awsume supported the ability to execute a command, while setting up the credentials, only for that specific command.

For example: awsume exec production -- aws s3 ls

In my personal case, I use AWS EKS, and need access to many clusters in many accounts. Since our access is based around Roles and sessions, I need to remember to awsume before trying to interact with the cluster into the right account/role.

I'd like to be able to change my kubeconfig in a way that would awsume automatically to whatever role is required for that one particular cluster.

So it would look something like this:

- name: arn:aws:eks:us-west-2:012345678901:cluster/production-0
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      args:
      - exec
      - production
      - --
      - aws
      - --region
      - us-west-2
      - eks
      - get-token
      - --cluster-name
      - production-0
      command: awsume