design-patterns/cloudformation/lab.yaml [202:261]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Tags:
        - Key: Name
          Value: !Ref 'AWS::StackName'
      UserData:
        Fn::Base64:
          Fn::Sub:
            - |
              Content-Type: multipart/mixed; boundary="//"
              MIME-Version: 1.0

              --//
              Content-Type: text/cloud-config; charset="us-ascii"
              MIME-Version: 1.0
              Content-Transfer-Encoding: 7bit
              Content-Disposition: attachment; filename="cloud-config.txt"

              #cloud-config
              locale: en_US.utf-8

              --//
              Content-Type: text/x-shellscript; charset="us-ascii"
              MIME-Version: 1.0
              Content-Transfer-Encoding: 7bit
              Content-Disposition: attachment; filename="userdata.sh"

              #!/bin/bash
              echo [`date -u +"%Y-%m-%dT%H:%M:%SZ"`] Started Design Patterns User Data
              set -x

              function sleep_delay
              {
                if (( $SLEEP_TIME < $SLEEP_TIME_MAX )); then
                  echo Sleeping $SLEEP_TIME
                  sleep $SLEEP_TIME
                  SLEEP_TIME=$(($SLEEP_TIME * 2))
                else
                  echo Sleeping $SLEEP_TIME_MAX
                  sleep $SLEEP_TIME_MAX
                fi
              }

              # Executing bootstrap script
              SLEEP_TIME=10
              SLEEP_TIME_MAX=3600
              while true; do
                curl "${SUB_USERDATA_URL}" > /tmp/designpatternsbootstrap.sh
                RESULT=$?
                if [[ "$RESULT" -ne 0 ]]; then
                  sleep_delay
                else
                  /bin/bash /tmp/designpatternsbootstrap.sh ${SUB_GUID} "${WorkshopCodeURL}" ${AWS::Region} ${AWS::AccountId} "${SUB_REPL_ROLE}" "${WorkshopWaitHandle}" &&
                  exit 0
                fi
              done
              --//
            - {
              SUB_USERDATA_URL: !FindInMap [DesignPatterns, options, UserDataURL],
              SUB_GUID: !FindInMap [AmazonLinuxAMI, !Ref "AWS::Region", GUID],
              SUB_REPL_ROLE: !GetAtt ['DDBReplicationRole', 'Arn'],
            }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



design-patterns/cloudformation/lab.yaml [275:334]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Tags:
        - Key: Name
          Value: !Ref 'AWS::StackName'
      UserData:
        Fn::Base64:
          Fn::Sub:
            - |
              Content-Type: multipart/mixed; boundary="//"
              MIME-Version: 1.0

              --//
              Content-Type: text/cloud-config; charset="us-ascii"
              MIME-Version: 1.0
              Content-Transfer-Encoding: 7bit
              Content-Disposition: attachment; filename="cloud-config.txt"

              #cloud-config
              locale: en_US.utf-8

              --//
              Content-Type: text/x-shellscript; charset="us-ascii"
              MIME-Version: 1.0
              Content-Transfer-Encoding: 7bit
              Content-Disposition: attachment; filename="userdata.sh"

              #!/bin/bash
              echo [`date -u +"%Y-%m-%dT%H:%M:%SZ"`] Started Design Patterns User Data
              set -x

              function sleep_delay
              {
                if (( $SLEEP_TIME < $SLEEP_TIME_MAX )); then
                  echo Sleeping $SLEEP_TIME
                  sleep $SLEEP_TIME
                  SLEEP_TIME=$(($SLEEP_TIME * 2))
                else
                  echo Sleeping $SLEEP_TIME_MAX
                  sleep $SLEEP_TIME_MAX
                fi
              }

              # Executing bootstrap script
              SLEEP_TIME=10
              SLEEP_TIME_MAX=3600
              while true; do
                curl "${SUB_USERDATA_URL}" > /tmp/designpatternsbootstrap.sh
                RESULT=$?
                if [[ "$RESULT" -ne 0 ]]; then
                  sleep_delay
                else
                  /bin/bash /tmp/designpatternsbootstrap.sh ${SUB_GUID} "${WorkshopCodeURL}" ${AWS::Region} ${AWS::AccountId} "${SUB_REPL_ROLE}" "${WorkshopWaitHandle}" &&
                  exit 0
                fi
              done
              --//
            - {
              SUB_USERDATA_URL: !FindInMap [DesignPatterns, options, UserDataURL],
              SUB_GUID: !FindInMap [AmazonLinuxAMI, !Ref "AWS::Region", GUID],
              SUB_REPL_ROLE: !GetAtt ['DDBReplicationRole', 'Arn'],
            }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



