templates/automationdocuments/AWSQuickstart-ActiveDirectoryDS.yaml [1:184]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---
schemaVersion: "0.3"
description: "Deploy AD with SSM Automation"
# Role that is utilized to perform the steps within the Automation Document. In this case to be able to Signal CFN and Describe Instances. 
assumeRole: "{{AutomationAssumeRole}}"
# Gathering parameters needed to configure DCs in the Quick Start
parameters: 
  ADServer1NetBIOSName:
    default: "DC1"
    description: "NetBIOS name of the first Active Directory server (up to 15 characters)"
    type: "String"
  ADServer1PrivateIP:
    default: "10.0.0.10"
    description: "Fixed private IP for the first Active Directory server located in Availability Zone 1"
    type: "String"
  ADServer2NetBIOSName:
    default: "DC2"
    description: "NetBIOS name of the first Active Directory server (up to 15 characters)"
    type: "String"
  ADServer2PrivateIP:
    default: "10.0.32.10"
    description: "Fixed private IP for the first Active Directory server located in Availability Zone 1"
    type: "String"
  VPCCIDR:
    default: '10.0.0.0/16'
    description: "CIDR block for private subnet 1 located in Availability Zone 1."
    type: "String"
  ADAdminSecParamName:
    description: "AWS Secrets Parameter Name that has Password and User namer for the domain administrator."
    type: "String"
  ADAltUserSecParamName:
    description: "AWS Secrets Parameter Name for the account that will be added as Domain Administrator. This is separate from the default Administrator account"
    type: "String"
  RestoreModeSecParamName:
    description: "AWS Secrets Parameter Name for the Restore Mode Password"
    type: "String"
  DomainDNSName: 
    default: "example.com"
    description: "Fully qualified domain name (FQDN) of the forest root domain e.g. example.com"
    type: "String"
  DomainNetBIOSName: 
    default: "example"
    description: "NetBIOS name of the domain (up to 15 characters) for users of earlier versions of Windows e.g. EXAMPLE"
    type: "String"
  QSS3BucketName:
    default: "aws-quickstart"
    description: "S3 bucket name for the Quick Start assets. Quick Start bucket name can include numbers, lowercase letters, uppercase letters, and hyphens (-). It cannot start or end with a hyphen (-)."
    type: "String"
  QSS3BucketRegion:
    default: "us-east-1"
    description: "The AWS Region where the Quick Start S3 bucket (QSS3BucketName) is hosted. When using your own bucket, you must specify this value."
    type: "String"
  QSS3KeyPrefix:
    default: "quickstart-microsoft-activedirectory/"
    description: "S3 key prefix for the Quick Start assets. Quick Start key prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slash (/)."
    type: "String"
  StackName:
    default: ""
    description: "Stack Name Input for cfn resource signal"
    type: "String"
  URLSuffix:
    default: "amazonaws.com"
    description: "AWS URL suffix"
    type: "String"
  AutomationAssumeRole:
    default: ""
    description: "(Optional) The ARN of the role that allows Automation to perform the actions on your behalf."
    type: "String"
mainSteps:
# This step grabs the Instance IDs for both nodes that will be configured as DCs in the Quick Start and Instance IDs for the for next steps.
- name: "dcsInstanceIds"
  action: aws:executeAwsApi
  onFailure: "step:signalfailure"
  nextStep: "dcsInstallDscModules"
  inputs:
    Service: ec2
    Api: DescribeInstances
    Filters:  
    - Name: "tag:Name"
      Values: [ "{{ADServer1NetBIOSName}}","{{ADServer2NetBIOSName}}" ]
    - Name: "tag:aws:cloudformation:stack-name"
      Values: ["{{StackName}}"]
    - Name: "instance-state-name"
      Values: [ "running" ]
  outputs:
  - Name: InstanceIds
    Selector: "$.Reservations..Instances..InstanceId"
    Type: "StringList"
# Installs needed Powershell DSC Modules and components on both nodes.
- name: "dcsInstallDscModules"
  action: "aws:runCommand"
  onFailure: "step:signalfailure"
  nextStep: "dcsLCMConfig"
  inputs:
    DocumentName: "AWS-RunRemoteScript"
    InstanceIds:
    - "{{dcsInstanceIds.InstanceIds}}"
    CloudWatchOutputConfig:
      CloudWatchOutputEnabled: "true"
      CloudWatchLogGroupName: !Ref 'QuickStartLogs'
    Parameters:
      sourceType: "S3"
      sourceInfo: 
        !Sub 
          - '{"path": "https://${S3Bucket}.s3.${S3Region}.{{URLSuffix}}/{{QSS3KeyPrefix}}scripts/install-ad-modules.ps1"}'
          - S3Bucket: !If
              - UsingDefaultBucket
              - !Sub '${QSS3BucketName}-${AWS::Region}'
              - !Ref QSS3BucketName
            S3Region: !If 
              - UsingDefaultBucket
              - !Ref AWS::Region
              - !Ref QSS3BucketRegion
      commandLine: "./install-ad-modules.ps1"
# Configures Local Configuration Manager on each of the nodes.
- name: "dcsLCMConfig"
  action: "aws:runCommand"
  onFailure: "step:signalfailure"
  nextStep: "dc1InstanceId"
  inputs:
    DocumentName: "AWS-RunRemoteScript"
    InstanceIds:
    - "{{dcsInstanceIds.InstanceIds}}"
    CloudWatchOutputConfig:
      CloudWatchOutputEnabled: "true"
      CloudWatchLogGroupName: !Ref 'QuickStartLogs'
    Parameters:
      sourceType: "S3"
      sourceInfo: 
        !Sub 
          - '{"path": "https://${S3Bucket}.s3.${S3Region}.{{URLSuffix}}/{{QSS3KeyPrefix}}scripts/LCM-Config.ps1"}'
          - S3Bucket: !If
              - UsingDefaultBucket
              - !Sub '${QSS3BucketName}-${AWS::Region}'
              - !Ref QSS3BucketName
            S3Region: !If 
              - UsingDefaultBucket
              - !Ref AWS::Region
              - !Ref QSS3BucketRegion
      commandLine: "./LCM-Config.ps1"
# This step grabs the Instance ID for the node that will be configured as the first DC in the new domain.
- name: "dc1InstanceId"
  action: aws:executeAwsApi
  onFailure: "step:signalfailure"
  nextStep: "createDC1Mof"
  inputs:
    Service: ec2
    Api: DescribeInstances
    Filters:  
    - Name: "tag:Name"
      Values: [ "{{ADServer1NetBIOSName}}" ]
    - Name: "tag:aws:cloudformation:stack-name"
      Values: ["{{StackName}}"]
    - Name: "instance-state-name"
      Values: [ "running" ]
  outputs:
  - Name: InstanceId
    Selector: "$.Reservations[0].Instances[0].InstanceId"
    Type: "String"
# Generates MOF file on first DC Node to be processed by LCM.
- name: "createDC1Mof"
  action: "aws:runCommand"
  onFailure: "step:signalfailure"
  nextStep: "configDC1"
  inputs:
    DocumentName: "AWS-RunRemoteScript"
    InstanceIds:
    - "{{dc1InstanceId.InstanceId}}"
    CloudWatchOutputConfig:
      CloudWatchOutputEnabled: "true"
      CloudWatchLogGroupName: !Ref 'QuickStartLogs'
    Parameters:
      sourceType: "S3"
      sourceInfo: 
        !Sub
          - '{"path": "https://${S3Bucket}.s3.${S3Region}.{{URLSuffix}}/{{QSS3KeyPrefix}}scripts/ConfigDC1.ps1"}'
          - S3Bucket: !If
              - UsingDefaultBucket
              - !Sub '${QSS3BucketName}-${AWS::Region}'
              - !Ref QSS3BucketName
            S3Region: !If 
              - UsingDefaultBucket
              - !Ref AWS::Region
              - !Ref QSS3BucketRegion
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



templates/automationdocuments/AWSQuickstart-extendAD.yaml [1:184]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---
schemaVersion: "0.3"
description: "Deploy AD with SSM Automation"
# Role that is utilized to perform the steps within the Automation Document. In this case to be able to Signal CFN and Describe Instances. 
assumeRole: "{{AutomationAssumeRole}}"
# Gathering parameters needed to configure DCs in the Quick Start
parameters: 
  ADServer1NetBIOSName:
    default: "DC1"
    description: "NetBIOS name of the first Active Directory server (up to 15 characters)"
    type: "String"
  ADServer1PrivateIP:
    default: "10.0.0.10"
    description: "Fixed private IP for the first Active Directory server located in Availability Zone 1"
    type: "String"
  ADServer2NetBIOSName:
    default: "DC2"
    description: "NetBIOS name of the first Active Directory server (up to 15 characters)"
    type: "String"
  ADServer2PrivateIP:
    default: "10.0.32.10"
    description: "Fixed private IP for the first Active Directory server located in Availability Zone 1"
    type: "String"
  VPCCIDR:
    default: '10.0.0.0/16'
    description: "CIDR block for private subnet 1 located in Availability Zone 1."
    type: "String"
  ADAdminSecParamName:
    description: "AWS Secrets Parameter Name that has Password and User namer for the domain administrator."
    type: "String"
  ADAltUserSecParamName:
    description: "AWS Secrets Parameter Name for the account that will be added as Domain Administrator. This is separate from the default Administrator account"
    type: "String"
  RestoreModeSecParamName:
    description: "AWS Secrets Parameter Name for the Restore Mode Password"
    type: "String"
  DomainDNSName: 
    default: "example.com"
    description: "Fully qualified domain name (FQDN) of the forest root domain e.g. example.com"
    type: "String"
  DomainNetBIOSName: 
    default: "example"
    description: "NetBIOS name of the domain (up to 15 characters) for users of earlier versions of Windows e.g. EXAMPLE"
    type: "String"
  QSS3BucketName:
    default: "aws-quickstart"
    description: "S3 bucket name for the Quick Start assets. Quick Start bucket name can include numbers, lowercase letters, uppercase letters, and hyphens (-). It cannot start or end with a hyphen (-)."
    type: "String"
  QSS3BucketRegion:
    default: "us-east-1"
    description: "The AWS Region where the Quick Start S3 bucket (QSS3BucketName) is hosted. When using your own bucket, you must specify this value."
    type: "String"
  QSS3KeyPrefix:
    default: "quickstart-microsoft-activedirectory/"
    description: "S3 key prefix for the Quick Start assets. Quick Start key prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slash (/)."
    type: "String"
  StackName:
    default: ""
    description: "Stack Name Input for cfn resource signal"
    type: "String"
  URLSuffix:
    default: "amazonaws.com"
    description: "AWS URL suffix"
    type: "String"
  AutomationAssumeRole:
    default: ""
    description: "(Optional) The ARN of the role that allows Automation to perform the actions on your behalf."
    type: "String"
mainSteps:
# This step grabs the Instance IDs for both nodes that will be configured as DCs in the Quick Start and Instance IDs for the for next steps.
- name: "dcsInstanceIds"
  action: aws:executeAwsApi
  onFailure: "step:signalfailure"
  nextStep: "dcsInstallDscModules"
  inputs:
    Service: ec2
    Api: DescribeInstances
    Filters:  
    - Name: "tag:Name"
      Values: [ "{{ADServer1NetBIOSName}}","{{ADServer2NetBIOSName}}" ]
    - Name: "tag:aws:cloudformation:stack-name"
      Values: ["{{StackName}}"]
    - Name: "instance-state-name"
      Values: [ "running" ]
  outputs:
  - Name: InstanceIds
    Selector: "$.Reservations..Instances..InstanceId"
    Type: "StringList"
# Installs needed Powershell DSC Modules and components on both nodes.
- name: "dcsInstallDscModules"
  action: "aws:runCommand"
  onFailure: "step:signalfailure"
  nextStep: "dcsLCMConfig"
  inputs:
    DocumentName: "AWS-RunRemoteScript"
    InstanceIds:
    - "{{dcsInstanceIds.InstanceIds}}"
    CloudWatchOutputConfig:
      CloudWatchOutputEnabled: "true"
      CloudWatchLogGroupName: !Ref 'QuickStartLogs'
    Parameters:
      sourceType: "S3"
      sourceInfo: 
        !Sub 
          - '{"path": "https://${S3Bucket}.s3.${S3Region}.{{URLSuffix}}/{{QSS3KeyPrefix}}scripts/install-ad-modules.ps1"}'
          - S3Bucket: !If
              - UsingDefaultBucket
              - !Sub '${QSS3BucketName}-${AWS::Region}'
              - !Ref QSS3BucketName
            S3Region: !If 
              - UsingDefaultBucket
              - !Ref AWS::Region
              - !Ref QSS3BucketRegion
      commandLine: "./install-ad-modules.ps1"
# Configures Local Configuration Manager on each of the nodes.
- name: "dcsLCMConfig"
  action: "aws:runCommand"
  onFailure: "step:signalfailure"
  nextStep: "dc1InstanceId"
  inputs:
    DocumentName: "AWS-RunRemoteScript"
    InstanceIds:
    - "{{dcsInstanceIds.InstanceIds}}"
    CloudWatchOutputConfig:
      CloudWatchOutputEnabled: "true"
      CloudWatchLogGroupName: !Ref 'QuickStartLogs'
    Parameters:
      sourceType: "S3"
      sourceInfo: 
        !Sub 
          - '{"path": "https://${S3Bucket}.s3.${S3Region}.{{URLSuffix}}/{{QSS3KeyPrefix}}scripts/LCM-Config.ps1"}'
          - S3Bucket: !If
              - UsingDefaultBucket
              - !Sub '${QSS3BucketName}-${AWS::Region}'
              - !Ref QSS3BucketName
            S3Region: !If 
              - UsingDefaultBucket
              - !Ref AWS::Region
              - !Ref QSS3BucketRegion
      commandLine: "./LCM-Config.ps1"
# This step grabs the Instance ID for the node that will be configured as the first DC in the new domain.
- name: "dc1InstanceId"
  action: aws:executeAwsApi
  onFailure: "step:signalfailure"
  nextStep: "createDC1Mof"
  inputs:
    Service: ec2
    Api: DescribeInstances
    Filters:  
    - Name: "tag:Name"
      Values: [ "{{ADServer1NetBIOSName}}" ]
    - Name: "tag:aws:cloudformation:stack-name"
      Values: ["{{StackName}}"]
    - Name: "instance-state-name"
      Values: [ "running" ]
  outputs:
  - Name: InstanceId
    Selector: "$.Reservations[0].Instances[0].InstanceId"
    Type: "String"
# Generates MOF file on first DC Node to be processed by LCM.
- name: "createDC1Mof"
  action: "aws:runCommand"
  onFailure: "step:signalfailure"
  nextStep: "configDC1"
  inputs:
    DocumentName: "AWS-RunRemoteScript"
    InstanceIds:
    - "{{dc1InstanceId.InstanceId}}"
    CloudWatchOutputConfig:
      CloudWatchOutputEnabled: "true"
      CloudWatchLogGroupName: !Ref 'QuickStartLogs'
    Parameters:
      sourceType: "S3"
      sourceInfo: 
        !Sub
          - '{"path": "https://${S3Bucket}.s3.${S3Region}.{{URLSuffix}}/{{QSS3KeyPrefix}}scripts/ConfigDC1.ps1"}'
          - S3Bucket: !If
              - UsingDefaultBucket
              - !Sub '${QSS3BucketName}-${AWS::Region}'
              - !Ref QSS3BucketName
            S3Region: !If 
              - UsingDefaultBucket
              - !Ref AWS::Region
              - !Ref QSS3BucketRegion
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



