You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d66b8a0
Browse filesBrowse the repository at this point in the historyBrowse files
feat: exec, to run a command with credentials and the proxy endpoint
source-coop exec -- aws s3 ls s3://acct/prod/ runs any S3 tool as the
signed-in user, as aws-vault exec does: the role's current credentials
(cached, or minted as creds would) go into the command's environment,
with the proxy as AWS_ENDPOINT_URL(_S3) and S3_ENDPOINT_URL, a region if
none is set, and AWS_PROFILE removed. On Unix the CLI becomes the
command, so its exit code and signals reach the shell directly.
creds and exec share current_creds(), which mint() now takes a role and
proxy for rather than CredsArgs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This sets `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_SESSION_TOKEN` in your current shell.
134
134
135
+
### Running a command with your credentials (`exec`)
136
+
137
+
`source-coop exec` runs any S3 tool with your credentials and the data proxy as its endpoint, without a profile or exported variables, as `aws-vault exec` does for AWS:
138
+
139
+
```bash
140
+
source-coop exec -- aws s3 ls s3://my-org/my-product/
The command gets `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN` and `AWS_CREDENTIAL_EXPIRATION`, and the proxy URL as `AWS_ENDPOINT_URL_S3` (the AWS CLI v2.13+ and SDKs, for S3 only, so calls to other AWS services are unaffected) and `S3_ENDPOINT_URL` (s5cmd). `AWS_REGION` is set to `us-east-1` only if no region is set already (an empty one counts as unset). `AWS_PROFILE` and `AWS_DEFAULT_PROFILE` are removed so a profile's own credentials can't be mistaken for these, and `AWS_IGNORE_CONFIGURED_ENDPOINT_URLS` is removed so the command can't send them to AWS instead of the proxy. `--role-arn` and `--proxy-url` (or `SOURCE_ROLE_ARN` and `SOURCE_PROXY_URL`) pick the role and environment, as for `creds`. Everything after `--` is the command, flags included.
147
+
148
+
The command's exit code is passed on. Credentials are fetched once, when it starts: cached ones are used only with at least 15 minutes left, otherwise new ones are fetched. A command still running when they expire (an hour after they're fetched, unless you logged in with `--duration`) needs running again. If you're not signed in, `exec` exits with 4 without running the command.
0 commit comments