User Tools

Site Tools


aws:orgs

This is an old revision of the document!


Organisations

Get Root ID

With text output:-

OrgRoot=$(aws organizations list-roots --query 'Roots[0].Id' --output text)

Using JQ:-

OrgToot=$(aws organizations list-roots | jq -r .Roots.[0].Id)

Get a list of OU's in an organisation

OU_IDs=$(aws organizations describe-organization --query 'Organization.Id' --output text)  
#!/bin/bash
# Get the root of an Org and find the subordinate OUs in it.
 
ROOT_ID=$(aws organizations list-roots | jq -r .Roots.[0].Id)
printf "Root ID:- ${ROOT_ID}\n"
 
OUS=$(aws organizations list-organizational-units-for-parent --parent-id "${ROOT_ID}" | jq -c .OrganizationalUnits.[].Id)
printf "OUs:- ${OUS}\n\n"

Seearch for an OU by name:- <code bash> SpecificOU=$(aws organizations list-organizational-units-for-parent \

  1. -parent-id $RootId \
  2. -query 'OrganizationalUnits[?Name==`SpecificOU`].Id' –output text )

<code>

aws/orgs.1734089706.txt.gz · Last modified: by andrew

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki