assets/cloudformation/agent-portal-front-end.yaml [57:156]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        PriceClass: "PriceClass_All"
        Enabled: true
        ViewerCertificate:
          CloudFrontDefaultCertificate: true
          MinimumProtocolVersion: "TLSv1"
        HttpVersion: "http2"
        IPV6Enabled: true

  WebSiteS3BucketPolicy:
    Type: "AWS::S3::BucketPolicy"
    Properties:
      Bucket: !Ref WebSiteS3Bucket
      PolicyDocument:
        Version: "2012-10-17"
        Id: "PolicyForCloudFrontPrivateContent"
        Statement:
          - Sid: "1"
            Effect: "Allow"
            Principal:
              AWS: !Sub "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity ${CloudFrontCloudFrontOriginAccessIdentity}"
            Action: "s3:GetObject"
            Resource: !Sub "arn:aws:s3:::${WebSiteS3Bucket}/*"

  LambdaExecutionRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - lambda.amazonaws.com
            Action:
              - sts:AssumeRole
      Path: "/"
      Policies:
        - PolicyName: CloudWatchLogsPermissions
          PolicyDocument:
            Version: "2012-10-17"
            Statement:
              - Effect: Allow
                Action:
                  - logs:*
                Resource: arn:aws:logs:*:*:*
        - PolicyName: WebSiteS3BucketPermissions
          PolicyDocument:
            Version: "2012-10-17"
            Statement:
              - Effect: Allow
                Action:
                  - s3:GetObject
                  - s3:GetObjectVersion
                  - s3:GetObjectAcl
                  - s3:GetObjectTagging
                  - s3:PutObject
                  - s3:PutObjectAcl
                  - s3:PutObjectTagging
                  - s3:DeleteObject
                  - s3:DeleteObjectVersion
                  - s3:ListBucket
                  - s3:ListBucketVersions
                Resource:
                  - !Sub "arn:aws:s3:::${WebSiteS3Bucket}/*"
                  - !Sub "arn:aws:s3:::${WebSiteS3Bucket}"
        - PolicyName: OriginS3BucketPermissions
          PolicyDocument:
            Version: "2012-10-17"
            Statement:
              - Effect: Allow
                Action:
                  - s3:GetObject
                  - s3:ListBucket
                Resource:
                  - !Sub "arn:aws:s3:::${S3BucketAssets}/*"
                  - !Sub "arn:aws:s3:::${S3BucketAssets}"

  crhelperLayer:
    Type: AWS::Lambda::LayerVersion
    Properties:
      CompatibleRuntimes:
        - python3.7
      Content:
        S3Bucket: !Ref S3BucketAssets
        S3Key: lambda-functions/crhelperLambdaLayer.zip
      Description: CloudFormation Custom Resource Helper
      LayerName: cr-helper
      LicenseInfo: MIT                       

  CopyWebSite:
    Type: AWS::Lambda::Function
    Properties:
      Role: !GetAtt LambdaExecutionRole.Arn
      Runtime: "python3.7"
      Timeout: 600
      Description: "Download web site static content to local bucket"
      Handler: "lambda_function.lambda_handler"
      Environment:
        Variables:
          s3sourceBucket: !Ref S3BucketAssets
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



assets/cloudformation/customer-portal-front-end.yaml [57:156]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        PriceClass: "PriceClass_All"
        Enabled: true
        ViewerCertificate:
          CloudFrontDefaultCertificate: true
          MinimumProtocolVersion: "TLSv1"
        HttpVersion: "http2"
        IPV6Enabled: true

  WebSiteS3BucketPolicy:
    Type: "AWS::S3::BucketPolicy"
    Properties:
      Bucket: !Ref WebSiteS3Bucket
      PolicyDocument:
        Version: "2012-10-17"
        Id: "PolicyForCloudFrontPrivateContent"
        Statement:
          - Sid: "1"
            Effect: "Allow"
            Principal:
              AWS: !Sub "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity ${CloudFrontCloudFrontOriginAccessIdentity}"
            Action: "s3:GetObject"
            Resource: !Sub "arn:aws:s3:::${WebSiteS3Bucket}/*"

  LambdaExecutionRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - lambda.amazonaws.com
            Action:
              - sts:AssumeRole
      Path: "/"
      Policies:
        - PolicyName: CloudWatchLogsPermissions
          PolicyDocument:
            Version: "2012-10-17"
            Statement:
              - Effect: Allow
                Action:
                  - logs:*
                Resource: arn:aws:logs:*:*:*
        - PolicyName: WebSiteS3BucketPermissions
          PolicyDocument:
            Version: "2012-10-17"
            Statement:
              - Effect: Allow
                Action:
                  - s3:GetObject
                  - s3:GetObjectVersion
                  - s3:GetObjectAcl
                  - s3:GetObjectTagging
                  - s3:PutObject
                  - s3:PutObjectAcl
                  - s3:PutObjectTagging
                  - s3:DeleteObject
                  - s3:DeleteObjectVersion
                  - s3:ListBucket
                  - s3:ListBucketVersions
                Resource:
                  - !Sub "arn:aws:s3:::${WebSiteS3Bucket}/*"
                  - !Sub "arn:aws:s3:::${WebSiteS3Bucket}"
        - PolicyName: OriginS3BucketPermissions
          PolicyDocument:
            Version: "2012-10-17"
            Statement:
              - Effect: Allow
                Action:
                  - s3:GetObject
                  - s3:ListBucket
                Resource:
                  - !Sub "arn:aws:s3:::${S3BucketAssets}/*"
                  - !Sub "arn:aws:s3:::${S3BucketAssets}"
  
  crhelperLayer:
    Type: AWS::Lambda::LayerVersion
    Properties:
      CompatibleRuntimes:
        - python3.7
      Content:
        S3Bucket: !Ref S3BucketAssets
        S3Key: lambda-functions/crhelperLambdaLayer.zip
      Description: CloudFormation Custom Resource Helper
      LayerName: cr-helper
      LicenseInfo: MIT                

  CopyWebSite:
    Type: AWS::Lambda::Function
    Properties:
      Role: !GetAtt LambdaExecutionRole.Arn
      Runtime: "python3.7"
      Timeout: 600
      Description: "Download web site static content to local bucket"
      Handler: "lambda_function.lambda_handler"
      Environment:
        Variables:
          s3sourceBucket: !Ref S3BucketAssets
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



