templates/mgmt-1.template.yaml [351:428]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            type: 'String'
          StackName:
            default: ''
            description: 'Stack Name Input for cfn resource signal'
            type: 'String'
          URLSuffix:
            default: 'amazonaws.com'
            description: 'AWS URL suffix'
            type: 'String'
        mainSteps:
          - name: mgmtInstanceId
            action: aws:executeAwsApi
            onFailure: step:signalfailure
            inputs:
              Service: ec2
              Api: DescribeInstances
              Filters:
                - Name: tag:Name
                  Values: ['{{MgmtServerNetBIOSName}}']
                - 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
            nextStep: intializeInstance
          - name: intializeInstance
            action: aws:runCommand
            inputs:
              DocumentName: AWS-RunPowerShellScript
              InstanceIds:
                - '{{mgmtInstanceId.InstanceId}}'
              Parameters:
                commands: |-
                  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

                  $S3BucketName = '{{QSS3BucketName}}'
                  $S3KeyPrefix = '{{QSS3KeyPrefix}}'
                  $S3BucketRegion = '{{QSS3BucketRegion}}'

                  $CustomModules = @(
                      'Module-AD.psd1',
                      'Module-AD.psm1'
                  )

                  $Modules = @(
                      @{
                          Name = 'NetworkingDsc'
                          Version = '8.2.0'
                      },
                      @{
                          Name = 'ActiveDirectoryDsc'
                          Version = '6.0.1'
                      },
                      @{
                          Name = 'ComputerManagementDsc'
                          Version = '8.4.0'
                      },
                      @{
                          Name = 'DnsServerDsc'
                          Version = '3.0.0'
                      }
                  )

                  Write-Output 'Creating AWSQuickstart Directory'
                  Try {
                      $Null = New-Item -Path 'C:\AWSQuickstart\Module-AD' -ItemType 'Directory' -ErrorAction Stop
                  } Catch [System.Exception] {
                      Write-Output "Failed to create AWSQuickstart directory $_"
                      Exit 1
                  }

                  $S3KeyPrefix = $S3KeyPrefix.Substring(0,$S3KeyPrefix.Length -1)
                  Write-Output 'Downloading AD PowerShell Module'
                  Foreach ($CustomModule in $CustomModules) {
                      Try {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



templates/workshop/mgmt-1.template.yaml [328:405]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            type: 'String'
          StackName:
            default: ''
            description: 'Stack Name Input for cfn resource signal'
            type: 'String'
          URLSuffix:
            default: 'amazonaws.com'
            description: 'AWS URL suffix'
            type: 'String'
        mainSteps:
          - name: mgmtInstanceId
            action: aws:executeAwsApi
            onFailure: step:signalfailure
            inputs:
              Service: ec2
              Api: DescribeInstances
              Filters:
                - Name: tag:Name
                  Values: ['{{MgmtServerNetBIOSName}}']
                - 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
            nextStep: intializeInstance
          - name: intializeInstance
            action: aws:runCommand
            inputs:
              DocumentName: AWS-RunPowerShellScript
              InstanceIds:
                - '{{mgmtInstanceId.InstanceId}}'
              Parameters:
                commands: |-
                  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

                  $S3BucketName = '{{QSS3BucketName}}'
                  $S3KeyPrefix = '{{QSS3KeyPrefix}}'
                  $S3BucketRegion = '{{QSS3BucketRegion}}'

                  $CustomModules = @(
                      'Module-AD.psd1',
                      'Module-AD.psm1'
                  )

                  $Modules = @(
                      @{
                          Name = 'NetworkingDsc'
                          Version = '8.2.0'
                      },
                      @{
                          Name = 'ActiveDirectoryDsc'
                          Version = '6.0.1'
                      },
                      @{
                          Name = 'ComputerManagementDsc'
                          Version = '8.4.0'
                      },
                      @{
                          Name = 'DnsServerDsc'
                          Version = '3.0.0'
                      }
                  )

                  Write-Output 'Creating AWSQuickstart Directory'
                  Try {
                      $Null = New-Item -Path 'C:\AWSQuickstart\Module-AD' -ItemType 'Directory' -ErrorAction Stop
                  } Catch [System.Exception] {
                      Write-Output "Failed to create AWSQuickstart directory $_"
                      Exit 1
                  }

                  $S3KeyPrefix = $S3KeyPrefix.Substring(0,$S3KeyPrefix.Length -1)
                  Write-Output 'Downloading AD PowerShell Module'
                  Foreach ($CustomModule in $CustomModules) {
                      Try {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



