aws:orgs
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
aws:orgs [10/12/2024 09:55] – created andrew | aws:orgs [11/02/2025 10:35] (current) – andrew | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Organisations ====== | ====== Organisations ====== | ||
+ | |||
+ | Get Root ID | ||
+ | |||
+ | With text output:- | ||
+ | OrgRoot=$(aws organizations list-roots --query ' | ||
+ | |||
+ | Using JQ:- | ||
+ | OrgToot=$(aws organizations list-roots | jq -r .Roots.[0].Id) | ||
===== Get a list of OU's in an organisation ===== | ===== Get a list of OU's in an organisation ===== | ||
+ | |||
+ | |||
+ | OU_IDs=$(aws organizations describe-organization --query ' | ||
+ | |||
Line 15: | Line 27: | ||
printf "OUs:- ${OUS}\n\n" | printf "OUs:- ${OUS}\n\n" | ||
</ | </ | ||
+ | |||
+ | |||
+ | Seearch for an OU by name:- | ||
+ | <code bash> | ||
+ | SpecificOU=$(aws organizations list-organizational-units-for-parent \ | ||
+ | --parent-id $RootId \ | ||
+ | --query ' | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Truncate account number ===== | ||
+ | |||
+ | Sometimes you may want to point to an account, but not reveal the full account number, this code will truncate your account to a specified length. | ||
+ | |||
+ | <code python> | ||
+ | $ cat truncate.py | ||
+ | # | ||
+ | |||
+ | account = ' | ||
+ | removechar = 6 | ||
+ | |||
+ | result1 = account[removechar: | ||
+ | result2 = account[removechar: | ||
+ | print(result1, | ||
+ | |||
+ | $ ./ | ||
+ | 784321 784321 | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ |
aws/orgs.1733824500.txt.gz · Last modified: by andrew