Skip to main content

ensure I always have up-to-date aws creds with the AWS CLI

ID
28446e9
date
2023-01-08 22:59:43+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
e560674
message
ensure I always have up-to-date aws creds with the AWS CLI
changed files
3 files, 22 additions, 2 deletions

Changed files

aws/aws (0) → aws/aws (388)

diff --git a/aws/aws b/aws/aws
new file mode 100755
index 0000000..88052bf
--- /dev/null
+++ b/aws/aws
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+# This provides a thin wrapper around the AWS CLI, and prefaces it by
+# ensuring I have up-to-date credentials.
+#
+# It relies on:
+#
+#   1. This script being before the regular AWS CLI in my $PATH
+#   2. Having the AWS CLI installed in the same dir across machines
+#
+
+set -o errexit
+set -o nounset
+
+_ensure_aws_credentials_are_fresh
+
+~/Library/Python/3.10/bin/aws "$@"

aws/login_ecr_public (236) → aws/login_ecr_public (248)

diff --git a/aws/login_ecr_public b/aws/login_ecr_public
index 32ace25..0fb1dc4 100755
--- a/aws/login_ecr_public
+++ b/aws/login_ecr_public
@@ -4,5 +4,7 @@ set -o errexit
 set -o nounset
 set -o verbose
 
-aws-azure-login --no-prompt
-AWS_PROFILE=experience-dev aws ecr-public --region=us-east-1 get-login-password | docker login --username AWS --password-stdin public.ecr.aws
\ No newline at end of file
+_ensure_aws_credentials_are_fresh
+
+AWS_PROFILE=experience-dev aws ecr-public \
+  --region=us-east-1 get-login-password | docker login --username AWS --password-stdin public.ecr.aws

aws/ssh_to_archivematica (1682) → aws/ssh_to_archivematica (1717)

diff --git a/aws/ssh_to_archivematica b/aws/ssh_to_archivematica
index 651f3a4..0356c97 100755
--- a/aws/ssh_to_archivematica
+++ b/aws/ssh_to_archivematica
@@ -3,6 +3,8 @@
 set -o errexit
 set -o nounset
 
+_ensure_aws_credentials_are_fresh
+
 ENVIRONMENT="${1:-}"
 
 if [[ "${ENVIRONMENT:-}" != "prod" && "${ENVIRONMENT:-}" != "staging" ]]