mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-05-06 00:46:56 +00:00
15 lines
475 B
Bash
Executable File
15 lines
475 B
Bash
Executable File
#!/bin/sh
|
|
# Attach our user policy to all the users defined in "users.txt".
|
|
# This should be idempotent, because attaching the same policy
|
|
# to the same user multiple times doesn't do anything.
|
|
|
|
ACCOUNT=$(aws sts get-caller-identity | jq -r .Account)
|
|
POLICY_NAME=user.container.training
|
|
|
|
for U in $(cat users.txt); do
|
|
echo "Attaching policy to user $U ..."
|
|
aws iam attach-user-policy \
|
|
--user-name $U \
|
|
--policy-arn arn:aws:iam::$ACCOUNT:policy/$POLICY_NAME
|
|
done
|