Created
January 28, 2020 06:16
-
-
Save mvanholsteijn/56f7b8410cd6873387110c2af9efe319 to your computer and use it in GitHub Desktop.
generates the SSM document required for automatic AD domain join on AWS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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