Skip to content

Commit 194e930

Browse files
NBBensepantherman594
authored andcommitted
Implement lock for aws-vault for better parallelization (#426)
* Implement lock for aws-vault for better parallelization Add locking mechanism to prevent concurrent aws-vault processes. * Update startupscript/aws/configure-aws-vault.sh --------- Co-authored-by: David Shen <2984600+pantherman594@users.noreply.github.com>
1 parent ee77701 commit 194e930

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

startupscript/aws/configure-aws-vault.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ export AWS_VAULT_FILE_PASSPHRASE=""
3838
# do not use.
3939
export DBUS_SESSION_BUS_ADDRESS="/dev/null"
4040
41+
if [ "\$1" = "export" ]; then
42+
# Use a lock to prevent multiple aws-vault processes from attempting to
43+
# retrieve credentials from wb at the same time
44+
exec 200>/var/lock/aws-vault.lock
45+
flock -w 30 200 || { echo "Failed to acquire lock for aws-vault export" >&2; exit 1; }
46+
fi
47+
4148
exec "${AWS_VAULT_BINARY_PATH}" "\$@"
4249
EOF
4350

0 commit comments

Comments
 (0)