aws:list_accounts_in_org
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
aws:list_accounts_in_org [23/06/2025 16:14] – andrew | aws:list_accounts_in_org [01/07/2025 13:37] (current) – andrew | ||
---|---|---|---|
Line 1: | Line 1: | ||
list_accounts_in_organisations.sh | list_accounts_in_organisations.sh | ||
- | |||
<code bash> | <code bash> | ||
#!/bin/bash | #!/bin/bash | ||
Line 14: | Line 13: | ||
# Using jq to parse the JSON | # Using jq to parse the JSON | ||
aws organizations list-accounts | jq -r ' | aws organizations list-accounts | jq -r ' | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | Iterates over the accounts in an organisation. | ||
+ | < | ||
+ | #!/bin/bash | ||
+ | |||
+ | ACCOUNTS_RAW=$(aws organizations list-accounts --query ' | ||
+ | ACCOUNTS=" | ||
+ | |||
+ | echo " | ||
+ | echo " | ||
+ | |||
+ | for ACCOUNT in $ACCOUNTS | ||
+ | do | ||
+ | echo " | ||
+ | echo "do some work on each account" | ||
+ | done | ||
</ | </ | ||
aws/list_accounts_in_org.1750695286.txt.gz · Last modified: by andrew