deployment/real-time-web-analytics-with-kinesis-existing-vpc.yaml [1387:1523]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  ProcessMetricsFunction:
    Type: AWS::Lambda::Function
    Properties:
      Code:
        S3Bucket: !Join ["-", [!FindInMap ["SourceCode", "General", "S3Bucket"], Ref: "AWS::Region"]]
        S3Key: !Join ["/", [!FindInMap ["SourceCode", "General", "KeyPrefix"], "wasa.zip"]]
      Environment:
        Variables:
          METRIC_TABLE: !Ref MetricTable
          METRIC_DETAILS_TABLE: !Ref MetricDetailsTable
          SOLUTION_UUID: !GetAtt GenerateUUID.UUID
          SOLUTION_ID: !FindInMap
            - Solution
            - Data
            - ID
          SOLUTION_VERSION: !FindInMap
            - Solution
            - Data
            - Version
          SEND_ANONYMOUS_DATA: !FindInMap
            - Solution
            - Data
            - SendAnonymousUsageData
      Description: Solution Accelerator for Web Analytics - Function to process metrics.
      Handler: index.handler
      MemorySize: 256
      Role: !GetAtt ProcessMetricsLambdaRole.Arn
      Runtime: nodejs10.x
      Timeout: 300

# Custom Resource
  CustomResourceHelper:
    Type: AWS::Lambda::Function
    Properties:
      Code:
        S3Bucket: !Join ["-", [!FindInMap ["SourceCode", "General", "S3Bucket"], Ref: "AWS::Region"]]
        S3Key: !Join ["/", [!FindInMap ["SourceCode", "General", "KeyPrefix"], "custom-resource.zip"]]
      Environment:
        Variables:
          SOLUTION_ID: !FindInMap
            - Solution
            - Data
            - ID
          SOLUTION_VERSION: !FindInMap
            - Solution
            - Data
            - Version
          SEND_ANONYMOUS_DATA: !FindInMap
            - Solution
            - Data
            - SendAnonymousUsageData
      Description: Solution Accelerator for Web Analytics - Function to deploy web
        pages.
      Handler: index.handler
      MemorySize: 256
      Role: !GetAtt 'CustomResourceHelperRole.Arn'
      Runtime: nodejs10.x
      Timeout: 300

  CustomResourceHelperRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - lambda.amazonaws.com
            Action:
              - sts:AssumeRole
      Path: /
      Policies:
        - PolicyName: CustomResourceHelperPolicy
          PolicyDocument:
            Version: '2012-10-17'
            Statement:
              - Effect: Allow
                Action:
                  - s3:PutObject
                  - s3:PutObjectAcl
                  - s3:DeleteObject
                  - s3:ListObjects
                  - s3:ListBucket
                Resource:
                  - !Sub '${WebsiteBucket.Arn}/*'
                  - !Sub '${WebsiteBucket.Arn}/'
                  - !GetAtt 'WebsiteBucket.Arn'
              - Effect: Allow
                Action:
                  - s3:GetObject
                Resource:
                  - !Sub
                    - arn:aws:s3:::${Param1}-${AWS::Region}/${Param2}/*
                    - Param1: !FindInMap
                        - SourceCode
                        - General
                        - S3Bucket
                      Param2: !FindInMap
                        - SourceCode
                        - General
                        - KeyPrefix
              - Sid: CWLogs
                Effect: Allow
                Action:
                  - logs:CreateLogGroup
                  - logs:CreateLogStream
                  - logs:PutDestination
                  - logs:PutLogEvents
                Resource:
                  - !Join ["", ["arn:aws:logs:", Ref: "AWS::Region", ":", Ref: "AWS::AccountId", ":log-group:/aws/lambda/*"]]
              - Effect: Allow
                Action:
                  - kinesisanalytics:StartApplication
                  - kinesisanalytics:DescribeApplication
                Resource:
                  - !Sub 'arn:aws:kinesisanalytics:${AWS::Region}:${AWS::AccountId}:application/${KinesisAnalyticsApp}'
              - Effect: Allow
                Action:
                  - kinesisanalytics:ListApplications
                Resource:
                  - '*'
              - Effect: Allow
                Action:
                  - ec2:describeImages
                Resource:
                  - '*'
              - Sid: DynamoDBAccess
                Effect: Allow
                Action:
                  - dynamodb:PutItem
                Resource:
                  - !GetAtt MetricTable.Arn
    Metadata:
      cfn_nag:
        rules_to_suppress:
          - id: W11
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



deployment/real-time-web-analytics-with-kinesis.yaml [1501:1637]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  ProcessMetricsFunction:
    Type: AWS::Lambda::Function
    Properties:
      Code:
        S3Bucket: !Join ["-", [!FindInMap ["SourceCode", "General", "S3Bucket"], Ref: "AWS::Region"]]
        S3Key: !Join ["/", [!FindInMap ["SourceCode", "General", "KeyPrefix"], "wasa.zip"]]
      Environment:
        Variables:
          METRIC_TABLE: !Ref MetricTable
          METRIC_DETAILS_TABLE: !Ref MetricDetailsTable
          SOLUTION_UUID: !GetAtt GenerateUUID.UUID
          SOLUTION_ID: !FindInMap
            - Solution
            - Data
            - ID
          SOLUTION_VERSION: !FindInMap
            - Solution
            - Data
            - Version
          SEND_ANONYMOUS_DATA: !FindInMap
            - Solution
            - Data
            - SendAnonymousUsageData
      Description: Solution Accelerator for Web Analytics - Function to process metrics.
      Handler: index.handler
      MemorySize: 256
      Role: !GetAtt ProcessMetricsLambdaRole.Arn
      Runtime: nodejs10.x
      Timeout: 300

# Custom Resource
  CustomResourceHelper:
    Type: AWS::Lambda::Function
    Properties:
      Code:
        S3Bucket: !Join ["-", [!FindInMap ["SourceCode", "General", "S3Bucket"], Ref: "AWS::Region"]]
        S3Key: !Join ["/", [!FindInMap ["SourceCode", "General", "KeyPrefix"], "custom-resource.zip"]]
      Environment:
        Variables:
          SOLUTION_ID: !FindInMap
            - Solution
            - Data
            - ID
          SOLUTION_VERSION: !FindInMap
            - Solution
            - Data
            - Version
          SEND_ANONYMOUS_DATA: !FindInMap
            - Solution
            - Data
            - SendAnonymousUsageData
      Description: Solution Accelerator for Web Analytics - Function to deploy web
        pages.
      Handler: index.handler
      MemorySize: 256
      Role: !GetAtt 'CustomResourceHelperRole.Arn'
      Runtime: nodejs10.x
      Timeout: 300

  CustomResourceHelperRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - lambda.amazonaws.com
            Action:
              - sts:AssumeRole
      Path: /
      Policies:
        - PolicyName: CustomResourceHelperPolicy
          PolicyDocument:
            Version: '2012-10-17'
            Statement:
              - Effect: Allow
                Action:
                  - s3:PutObject
                  - s3:PutObjectAcl
                  - s3:DeleteObject
                  - s3:ListObjects
                  - s3:ListBucket
                Resource:
                  - !Sub '${WebsiteBucket.Arn}/*'
                  - !Sub '${WebsiteBucket.Arn}/'
                  - !GetAtt 'WebsiteBucket.Arn'
              - Effect: Allow
                Action:
                  - s3:GetObject
                Resource:
                  - !Sub
                    - arn:aws:s3:::${Param1}-${AWS::Region}/${Param2}/*
                    - Param1: !FindInMap
                        - SourceCode
                        - General
                        - S3Bucket
                      Param2: !FindInMap
                        - SourceCode
                        - General
                        - KeyPrefix
              - Sid: CWLogs
                Effect: Allow
                Action:
                  - logs:CreateLogGroup
                  - logs:CreateLogStream
                  - logs:PutDestination
                  - logs:PutLogEvents
                Resource:
                  - !Join ["", ["arn:aws:logs:", Ref: "AWS::Region", ":", Ref: "AWS::AccountId", ":log-group:/aws/lambda/*"]]
              - Effect: Allow
                Action:
                  - kinesisanalytics:StartApplication
                  - kinesisanalytics:DescribeApplication
                Resource:
                  - !Sub 'arn:aws:kinesisanalytics:${AWS::Region}:${AWS::AccountId}:application/${KinesisAnalyticsApp}'
              - Effect: Allow
                Action:
                  - kinesisanalytics:ListApplications
                Resource:
                  - '*'
              - Effect: Allow
                Action:
                  - ec2:describeImages
                Resource:
                  - '*'
              - Sid: DynamoDBAccess
                Effect: Allow
                Action:
                  - dynamodb:PutItem
                Resource:
                  - !GetAtt MetricTable.Arn
    Metadata:
      cfn_nag:
        rules_to_suppress:
          - id: W11
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



