summaryrefslogtreecommitdiff
path: root/script/03_sts
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2022-04-22 17:30:21 -0600
committermo khan <mo@mokhan.ca>2022-04-22 17:30:21 -0600
commit0b09e735c9733f557e1ec7138e108e8d5bd7a7f5 (patch)
treee05d88d76fd8c2be3526e0bfd379bf4bbdc2a742 /script/03_sts
parent9fd1a9f376fb315ebbe8171aa989298fc34c66ce (diff)
rename bin to script
Diffstat (limited to 'script/03_sts')
-rwxr-xr-xscript/03_sts23
1 files changed, 23 insertions, 0 deletions
diff --git a/script/03_sts b/script/03_sts
new file mode 100755
index 0000000..737f427
--- /dev/null
+++ b/script/03_sts
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+set -e
+cd "$(dirname "$0")/.."
+HOST="${HOST:-http://localhost:8282}"
+
+if [ $# -eq 0 ]; then
+ echo "Usage:"
+ echo "$0 <id_token> <role_arn>"
+ exit 1
+fi
+
+ID_TOKEN="${1}"
+ROLE_ARN="${2}"
+
+echo "$ID_TOKEN" | ruby -rjson -rbase64 -e "puts Base64.decode64(STDIN.read.split('.')[1])" | jq '.'
+
+aws sts assume-role-with-web-identity \
+ --role-arn "${ROLE_ARN}" \
+ --role-session-name="example-1" \
+ --duration-seconds 900 \
+ --web-identity-token="${ID_TOKEN}" \
+ --output json | cat