okta / okta-aws-cli

A CLI for having Okta as the IdP for AWS CLI operations
https://github.com/okta/okta-aws-cli
Other
128 stars 34 forks source link

`--exec` subcommand #144

Closed monde closed 1 year ago

monde commented 1 year ago

Add --exec subcommand to avoid writing credentials to disk or injectinginto the shell

Closes #135

Example 1

$ okta-aws-cli m2m --format noop --exec -- printenv
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=ASIAUJHVCS6UYRTRTSQE
AWS_SECRET_ACCESS_KEY=TmvLOM/doSWfmIMK...
AWS_SESSION_TOKEN=FwoGZXIvYXdzEF8aDKrf...

Example 2

$ okta-aws-cli m2m --format noop --exec -- aws s3 ls s3://example
                           PRE aaa/
2023-03-08 16:01:01          4 a.log

Example 3 (process had error and also writes to STDERR)

$ okta-aws-cli m2m --format noop --exec -- aws s3 mb s3://no-access-example
error running process
aws s3 mb s3://yz-nomad-og
make_bucket failed: s3://no-access-example An error occurred (AccessDenied) when calling the CreateBucket operation: Access Denied

Error: exit status 1