deployment/real-time-web-analytics-with-kinesis-existing-vpc.yaml [1527:1778]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  GenerateUUID:
    Type: Custom::LoadLambda
    Properties:
      ServiceToken: !GetAtt 'CustomResourceHelper.Arn'
      CustomResourceAction: GenerateUUID

  SeedDynamoTable:
    Type: Custom::LoadLambda
    Properties:
      ServiceToken: !GetAtt CustomResourceHelper.Arn
      Region: !Ref AWS::Region
      TableName: !Ref MetricTable
      CustomResourceAction: SeedDynamoTable
      UUID: !GetAtt GenerateUUID.UUID

  ConfigureWebsite:
    Type: Custom::LoadLambda
    Properties:
      ServiceToken: !GetAtt CustomResourceHelper.Arn
      Region: !Ref AWS::Region
      CustomResourceAction: ConfigureWebsite
      SourceS3Bucket: !Sub
        - ${Param1}-${AWS::Region}
        - Param1: !FindInMap
            - SourceCode
            - General
            - S3Bucket
      SourceS3Key: !Sub
        - ${Param1}/web_site
        - Param1: !FindInMap
            - SourceCode
            - General
            - KeyPrefix
      WebsiteBucket: !Ref WebsiteBucket
      IdentityPoolId: !Ref CognitoIdentityPool
      UserPoolId: !Ref CognitoUserPool
      UserPoolClientId: !Ref CognitoUserPoolClient
      MetricsTableName: !Ref MetricTable
      MetricDetailsTableName: !Ref MetricDetailsTable
      UUID: !GetAtt GenerateUUID.UUID

  SendStackCreationMetric:
    Type: Custom::LoadLambda
    Properties:
      ServiceToken: !GetAtt CustomResourceHelper.Arn
      CustomResourceAction: SendMetric
      UUID: !GetAtt GenerateUUID.UUID
      EnableSSH: !Ref EnableSSH
      NodeSize: !Ref NodeSize
      CWDashboard: !Ref CWDashboard
      AutoScalingMinSize: !Ref AutoScalingMinSize
      AutoScalingMaxSize: !Ref AutoScalingMaxSize

  CloudWatchDashboard:
    Type: AWS::CloudWatch::Dashboard
    Properties:
      DashboardName: !Sub '${AWS::StackName}-Beacon-Servers-Metrics-${AWS::Region}'
      DashboardBody:
        !Sub
          - |
            {
               "widgets":[
                  {
                     "type":"metric",
                     "x":0,
                     "y":0,
                     "width":12,
                     "height":3,
                     "properties":{
                        "metrics":[
                           [
                              "AWS/ApplicationELB",
                              "HealthyHostCount",
                              "TargetGroup",
                              "${TargetGroup.TargetGroupFullName}",
                              "LoadBalancer",
                              "${ApplicationLoadBalancer.LoadBalancerFullName}"
                           ]
                        ],
                        "period":60,
                        "stat":"Maximum",
                        "region":"${AWS::Region}",
                        "title":"Number of Beacon Servers"
                     }
                  },
                  {
                     "type":"metric",
                     "x":0,
                     "y":4,
                     "width":12,
                     "height":3,
                     "properties":{
                        "metrics":[
                           [
                              "AWS/EC2",
                              "NetworkPacketsIn",
                              "AutoScalingGroupName",
                              "${AutoScalingGroup}"
                           ]
                        ],
                        "annotations": {
                           "horizontal": [
                             {
                                "visible":true,
                                "color":"#d62728",
                                "label":"Scale Up",
                                "value":${FindInMapScaleUp}
                             },
                             {
                                "visible":true,
                                "color":"#2ca02c",
                                "label":"Scale Down",
                                "value":${FindInMapScaleDown}
                             }

                          ]
                        },
                        "period":300,
                        "stat":"Average",
                        "region":"${AWS::Region}",
                        "title":"Average Network Packets In"
                     }
                  },
                  {
                     "type":"metric",
                     "x":0,
                     "y":8,
                     "width":12,
                     "height":6,
                     "properties":{
                        "metrics":[
                           [
                              "AWS/ApplicationELB",
                              "RequestCount",
                              "LoadBalancer",
                              "${ApplicationLoadBalancer.LoadBalancerFullName}",
                              {
                                "label":"Requests/Min"
                              }
                           ]
                        ],
                        "period":60,
                        "stat":"Sum",
                        "region":"${AWS::Region}",
                        "title":"Aggregate Request Count"
                     }
                  },
                  {
                     "type":"metric",
                     "x":13,
                     "y":0,
                     "width":12,
                     "height":3,
                     "properties":{
                        "metrics":[
                           [
                              "AWS/ApplicationELB",
                              "HTTPCode_ELB_5XX_Count",
                              "LoadBalancer",
                              "${ApplicationLoadBalancer.LoadBalancerFullName}"
                           ]
                        ],
                        "period":60,
                        "stat":"Sum",
                        "region":"${AWS::Region}",
                        "title":"Aggregate 5XX Error Count"
                     }
                  },
                  {
                     "type":"metric",
                     "x":13,
                     "y":4,
                     "width":12,
                     "height":3,
                     "properties":{
                        "metrics":[
                           [
                              "AWS/DynamoDB",
                              "WriteThrottleEvents",
                              "TableName",
                              "${MetricDetailsTable}"
                           ]
                        ],
                        "period":60,
                        "stat":"Sum",
                        "region":"${AWS::Region}",
                        "title":"Metric Details Table Write Throttle Events"
                     }
                  },
                  {
                     "type":"metric",
                     "x":13,
                     "y":8,
                     "width":12,
                     "height":6,
                     "properties":{
                        "metrics":[
                           [
                              "AWS/DynamoDB",
                              "ConsumedWriteCapacityUnits",
                              "TableName",
                              "${MetricDetailsTable}",
                              {
                                "yAxis":"left",
                                "label":"Consumed/Min",
                                "period":60,
                                "stat":"Sum"
                              }
                           ],
                           [
                              "AWS/DynamoDB",
                              "ProvisionedWriteCapacityUnits",
                              "TableName",
                              "${MetricDetailsTable}",
                              {
                                "yAxis":"right",
                                "label":"Provisioned",
                                "period":900,
                                "stat":"Maximum"
                              }
                           ]
                        ],
                        "period":60,
                        "stat":"Average",
                        "region":"${AWS::Region}",
                        "title":"Metric Details Table Consumed/Provisioned Capacity"
                     }
                  }
               ]
            }
          - {
            FindInMapScaleUp: !FindInMap [Sizing, !Ref NodeSize, PacketsPerMinHigh],
            FindInMapScaleDown: !FindInMap [Sizing, !Ref NodeSize, PacketsPerMinLow]
            }
Outputs:
  DashboardUrl:
    Description: The URL to the Dashboard.
    Value: !Sub 'https://${WebsiteDistribution.DomainName}/index.html'
  DashboardUserName:
    Value: !Ref UserName
  DataGenerator:
    Description: Generate test data command.
    Value: !Sub 'python ./test-beacon.py http://${ApplicationLoadBalancer.DNSName}/beacon 20000 0.5'
  BeaconDNS:
    Description: DNS name for beacon web server ALB.
    Value: !Sub ${ApplicationLoadBalancer.DNSName}
  BeaconServerUrl:
    Description: URL for beacon web servers.
    Value: !Sub http://${ApplicationLoadBalancer.DNSName}/beacon
  TestScriptUrl:
    Description: Link to download test-beacon.py for testing your beacon servers.
    Value: !Sub 'https://${WebsiteDistribution.DomainName}/test-beacon.py'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



deployment/real-time-web-analytics-with-kinesis.yaml [1642:1893]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  GenerateUUID:
    Type: Custom::LoadLambda
    Properties:
      ServiceToken: !GetAtt 'CustomResourceHelper.Arn'
      CustomResourceAction: GenerateUUID

  SeedDynamoTable:
    Type: Custom::LoadLambda
    Properties:
      ServiceToken: !GetAtt CustomResourceHelper.Arn
      Region: !Ref AWS::Region
      TableName: !Ref MetricTable
      CustomResourceAction: SeedDynamoTable
      UUID: !GetAtt GenerateUUID.UUID

  ConfigureWebsite:
    Type: Custom::LoadLambda
    Properties:
      ServiceToken: !GetAtt CustomResourceHelper.Arn
      Region: !Ref AWS::Region
      CustomResourceAction: ConfigureWebsite
      SourceS3Bucket: !Sub
        - ${Param1}-${AWS::Region}
        - Param1: !FindInMap
            - SourceCode
            - General
            - S3Bucket
      SourceS3Key: !Sub
        - ${Param1}/web_site
        - Param1: !FindInMap
            - SourceCode
            - General
            - KeyPrefix
      WebsiteBucket: !Ref WebsiteBucket
      IdentityPoolId: !Ref CognitoIdentityPool
      UserPoolId: !Ref CognitoUserPool
      UserPoolClientId: !Ref CognitoUserPoolClient
      MetricsTableName: !Ref MetricTable
      MetricDetailsTableName: !Ref MetricDetailsTable
      UUID: !GetAtt GenerateUUID.UUID

  SendStackCreationMetric:
    Type: Custom::LoadLambda
    Properties:
      ServiceToken: !GetAtt CustomResourceHelper.Arn
      CustomResourceAction: SendMetric
      UUID: !GetAtt GenerateUUID.UUID
      EnableSSH: !Ref EnableSSH
      NodeSize: !Ref NodeSize
      CWDashboard: !Ref CWDashboard
      AutoScalingMinSize: !Ref AutoScalingMinSize
      AutoScalingMaxSize: !Ref AutoScalingMaxSize

  CloudWatchDashboard:
    Type: AWS::CloudWatch::Dashboard
    Properties:
      DashboardName: !Sub '${AWS::StackName}-Beacon-Servers-Metrics-${AWS::Region}'
      DashboardBody:
        !Sub
          - |
            {
               "widgets":[
                  {
                     "type":"metric",
                     "x":0,
                     "y":0,
                     "width":12,
                     "height":3,
                     "properties":{
                        "metrics":[
                           [
                              "AWS/ApplicationELB",
                              "HealthyHostCount",
                              "TargetGroup",
                              "${TargetGroup.TargetGroupFullName}",
                              "LoadBalancer",
                              "${ApplicationLoadBalancer.LoadBalancerFullName}"
                           ]
                        ],
                        "period":60,
                        "stat":"Maximum",
                        "region":"${AWS::Region}",
                        "title":"Number of Beacon Servers"
                     }
                  },
                  {
                     "type":"metric",
                     "x":0,
                     "y":4,
                     "width":12,
                     "height":3,
                     "properties":{
                        "metrics":[
                           [
                              "AWS/EC2",
                              "NetworkPacketsIn",
                              "AutoScalingGroupName",
                              "${AutoScalingGroup}"
                           ]
                        ],
                        "annotations": {
                           "horizontal": [
                             {
                                "visible":true,
                                "color":"#d62728",
                                "label":"Scale Up",
                                "value":${FindInMapScaleUp}
                             },
                             {
                                "visible":true,
                                "color":"#2ca02c",
                                "label":"Scale Down",
                                "value":${FindInMapScaleDown}
                             }

                          ]
                        },
                        "period":300,
                        "stat":"Average",
                        "region":"${AWS::Region}",
                        "title":"Average Network Packets In"
                     }
                  },
                  {
                     "type":"metric",
                     "x":0,
                     "y":8,
                     "width":12,
                     "height":6,
                     "properties":{
                        "metrics":[
                           [
                              "AWS/ApplicationELB",
                              "RequestCount",
                              "LoadBalancer",
                              "${ApplicationLoadBalancer.LoadBalancerFullName}",
                              {
                                "label":"Requests/Min"
                              }
                           ]
                        ],
                        "period":60,
                        "stat":"Sum",
                        "region":"${AWS::Region}",
                        "title":"Aggregate Request Count"
                     }
                  },
                  {
                     "type":"metric",
                     "x":13,
                     "y":0,
                     "width":12,
                     "height":3,
                     "properties":{
                        "metrics":[
                           [
                              "AWS/ApplicationELB",
                              "HTTPCode_ELB_5XX_Count",
                              "LoadBalancer",
                              "${ApplicationLoadBalancer.LoadBalancerFullName}"
                           ]
                        ],
                        "period":60,
                        "stat":"Sum",
                        "region":"${AWS::Region}",
                        "title":"Aggregate 5XX Error Count"
                     }
                  },
                  {
                     "type":"metric",
                     "x":13,
                     "y":4,
                     "width":12,
                     "height":3,
                     "properties":{
                        "metrics":[
                           [
                              "AWS/DynamoDB",
                              "WriteThrottleEvents",
                              "TableName",
                              "${MetricDetailsTable}"
                           ]
                        ],
                        "period":60,
                        "stat":"Sum",
                        "region":"${AWS::Region}",
                        "title":"Metric Details Table Write Throttle Events"
                     }
                  },
                  {
                     "type":"metric",
                     "x":13,
                     "y":8,
                     "width":12,
                     "height":6,
                     "properties":{
                        "metrics":[
                           [
                              "AWS/DynamoDB",
                              "ConsumedWriteCapacityUnits",
                              "TableName",
                              "${MetricDetailsTable}",
                              {
                                "yAxis":"left",
                                "label":"Consumed/Min",
                                "period":60,
                                "stat":"Sum"
                              }
                           ],
                           [
                              "AWS/DynamoDB",
                              "ProvisionedWriteCapacityUnits",
                              "TableName",
                              "${MetricDetailsTable}",
                              {
                                "yAxis":"right",
                                "label":"Provisioned",
                                "period":900,
                                "stat":"Maximum"
                              }
                           ]
                        ],
                        "period":60,
                        "stat":"Average",
                        "region":"${AWS::Region}",
                        "title":"Metric Details Table Consumed/Provisioned Capacity"
                     }
                  }
               ]
            }
          - {
            FindInMapScaleUp: !FindInMap [Sizing, !Ref NodeSize, PacketsPerMinHigh],
            FindInMapScaleDown: !FindInMap [Sizing, !Ref NodeSize, PacketsPerMinLow]
            }
Outputs:
  DashboardUrl:
    Description: The URL to the Dashboard.
    Value: !Sub 'https://${WebsiteDistribution.DomainName}/index.html'
  DashboardUserName:
    Value: !Ref UserName
  DataGenerator:
    Description: Generate test data command.
    Value: !Sub 'python ./test-beacon.py http://${ApplicationLoadBalancer.DNSName}/beacon 20000 0.5'
  BeaconDNS:
    Description: DNS name for beacon web server ALB.
    Value: !Sub ${ApplicationLoadBalancer.DNSName}
  BeaconServerUrl:
    Description: URL for beacon web servers.
    Value: !Sub http://${ApplicationLoadBalancer.DNSName}/beacon
  TestScriptUrl:
    Description: Link to download test-beacon.py for testing your beacon servers.
    Value: !Sub 'https://${WebsiteDistribution.DomainName}/test-beacon.py'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



