Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvanholsteijn/56f7b8410cd6873387110c2af9efe319 to your computer and use it in GitHub Desktop.
Save mvanholsteijn/56f7b8410cd6873387110c2af9efe319 to your computer and use it in GitHub Desktop.
generates the SSM document required for automatic AD domain join on AWS
#!/bin/bash
aws ds describe-directories --query 'DirectoryDescriptions[*].{
"schemaVersion": `"1.0"`,
"description": join(``, [`Automatic AD domain-join configuration for `, Name, `.`]),
"runtimeConfig": {
"aws:domainJoin": {
"properties": {
"directoryId": DirectoryId,
"directoryName": Name,
"dnsIpAddresses": OwnerDirectoryDescription.DnsIpAddrs
}
}
}
}' | jq -r '.[] | ("aws ssm create-document --cli-input-json '"'"'" + ( {
"Content": (.|tostring),
"Name": ("awsconfig_Domain_" + .runtimeConfig["aws:domainJoin"].properties.directoryName)
} | tostring) + "'"'"'")'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment