diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..ffba39b5 Binary files /dev/null and b/.DS_Store differ diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/amazon-transcribe-post-call-analytics.iml b/.idea/amazon-transcribe-post-call-analytics.iml new file mode 100644 index 00000000..d6ebd480 --- /dev/null +++ b/.idea/amazon-transcribe-post-call-analytics.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/aws.xml b/.idea/aws.xml new file mode 100644 index 00000000..e14a2062 --- /dev/null +++ b/.idea/aws.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/cfnlintPlugin.xml b/.idea/cfnlintPlugin.xml new file mode 100644 index 00000000..e700753a --- /dev/null +++ b/.idea/cfnlintPlugin.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..639900d1 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..1823aeee --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..bc514777 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/pca-main-nokendra.template b/pca-main-nokendra.template index e8e0bca7..02e9a1bb 100644 --- a/pca-main-nokendra.template +++ b/pca-main-nokendra.template @@ -354,8 +354,8 @@ Parameters: DatabaseName: Type: String - Default: 'pca' - Description: Glue catalog database name used to contain tables/views for SQL integration. + AllowedPattern: "[a-zA-Z0-9_-]+" + Description: (Required) Glue catalog database name used to contain tables/views for SQL integration. EnablePcaDashboards: Type: String @@ -848,6 +848,7 @@ Resources: Properties: TemplateURL: pca-ssm/cfn/ssm.template Parameters: + StackName: !Ref 'AWS::StackName' BulkUploadBucketName: !If - ShouldCreateBulkUploadBucket @@ -918,6 +919,8 @@ Resources: Type: AWS::CloudFormation::Stack Properties: TemplateURL: pca-server/cfn/lib/python-utilities.template + Parameters: + ParentStackName: !Ref 'AWS::StackName' BedrockBoto3Layer: Type: AWS::CloudFormation::Stack @@ -944,6 +947,8 @@ Resources: Properties: TemplateURL: pca-server/cfn/pca-server.template Parameters: + DatabaseName: !Ref DatabaseName + ParentStackName: !Ref 'AWS::StackName' ffmpegDownloadUrl: !Ref ffmpegDownloadUrl CallSummarization: !Ref CallSummarization SummarizationBedrockModelId: !Ref SummarizationBedrockModelId @@ -966,6 +971,7 @@ Resources: Properties: TemplateURL: pca-ui/cfn/pca-ui.template Parameters: + ParentStackName: !Ref 'AWS::StackName' AdminUsername: !Ref AdminUsername AdminEmail: !Ref AdminEmail AllowedSignUpEmailDomain: !Ref AllowedSignUpEmailDomain diff --git a/pca-main.template b/pca-main.template index c99c4a71..504a4a41 100644 --- a/pca-main.template +++ b/pca-main.template @@ -395,8 +395,8 @@ Parameters: DatabaseName: Type: String - Default: 'pca' - Description: Glue catalog database name used to contain tables/views for SQL integration. + AllowedPattern: "[a-zA-Z0-9_-]+" + Description: (Required) Glue catalog database name used to contain tables/views for SQL integration. EnablePcaDashboards: Type: String @@ -1031,6 +1031,7 @@ Resources: Properties: TemplateURL: pca-ssm/cfn/ssm.template Parameters: + StackName: !Ref 'AWS::StackName' BulkUploadBucketName: !If - ShouldCreateBulkUploadBucket @@ -1102,6 +1103,8 @@ Resources: Type: AWS::CloudFormation::Stack Properties: TemplateURL: pca-server/cfn/lib/python-utilities.template + Parameters: + ParentStackName: !Ref 'AWS::StackName' BedrockBoto3Layer: Type: AWS::CloudFormation::Stack @@ -1128,6 +1131,8 @@ Resources: Properties: TemplateURL: pca-server/cfn/pca-server.template Parameters: + DatabaseName: !Ref DatabaseName + ParentStackName: !Ref 'AWS::StackName' ffmpegDownloadUrl: !Ref ffmpegDownloadUrl CallSummarization: !Ref CallSummarization SummarizationBedrockModelId: !Ref SummarizationBedrockModelId @@ -1150,6 +1155,7 @@ Resources: Properties: TemplateURL: pca-ui/cfn/pca-ui.template Parameters: + ParentStackName: !Ref 'AWS::StackName' AdminUsername: !Ref AdminUsername AdminEmail: !Ref AdminEmail AllowedSignUpEmailDomain: !Ref AllowedSignUpEmailDomain diff --git a/pca-server/cfn/lib/boto3.template b/pca-server/cfn/lib/boto3.template index 575878c2..8238e131 100644 --- a/pca-server/cfn/lib/boto3.template +++ b/pca-server/cfn/lib/boto3.template @@ -5,10 +5,13 @@ Description: Amazon Transcribe Post Call Analytics - PCA Server - Boto3 Layer Zi Transform: AWS::Serverless-2016-10-31 Parameters: + ParentStackName: + Type: String + Description: Name of the parent stack - SupportFilesBucketName: - Type: AWS::SSM::Parameter::Value - Default: SupportFilesBucketName +# SupportFilesBucketName: +# Type: AWS::SSM::Parameter::Value +# Default: SupportFilesBucketName Boto3ZipName: Type: String @@ -36,7 +39,7 @@ Resources: Resource: !Sub - 'arn:aws:s3:::${bucket}*' - - bucket: !Ref SupportFilesBucketName + - bucket: !Sub '{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}' Action: - 's3:PutObject' PolicyName: boto3ZipFunctionS3Policy @@ -51,7 +54,7 @@ Resources: MemorySize: 512 Environment: Variables: - SUPPORT_FILES_BUCKET: !Ref SupportFilesBucketName + SUPPORT_FILES_BUCKET: !Sub '{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}' BOTO3_ZIP_NAME: !Ref Boto3ZipName Code: ZipFile: | @@ -124,7 +127,7 @@ Resources: DependsOn: boto3Zip Properties: Content: - S3Bucket: !Ref SupportFilesBucketName + S3Bucket: !Sub '{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}' S3Key: !Ref Boto3ZipName Outputs: diff --git a/pca-server/cfn/lib/bulk.template b/pca-server/cfn/lib/bulk.template index 009bc214..09a91048 100644 --- a/pca-server/cfn/lib/bulk.template +++ b/pca-server/cfn/lib/bulk.template @@ -5,17 +5,21 @@ Description: Amazon Transcribe Post Call Analytics - PCA Server - BulkImport Sta Transform: AWS::Serverless-2016-10-31 Parameters: - BulkUploadStepFunctionName: - Type: AWS::SSM::Parameter::Value - Default: BulkUploadStepFunctionName + ParentStackName: + Type: String + Description: Name of the parent stack - BulkUploadBucketName: - Type: AWS::SSM::Parameter::Value - Default: BulkUploadBucket - - InputBucketName: - Type: AWS::SSM::Parameter::Value - Default: InputBucketName +# BulkUploadStepFunctionName: +# Type: AWS::SSM::Parameter::Value +# Default: BulkUploadStepFunctionName + +# BulkUploadBucketName: +# Type: AWS::SSM::Parameter::Value +# Default: BulkUploadBucket + +# InputBucketName: +# Type: AWS::SSM::Parameter::Value +# Default: InputBucketName Globals: Function: @@ -37,8 +41,17 @@ Resources: - s3:ListBucket - s3:GetObject Resource: - - !Sub arn:aws:s3:::${BulkUploadBucketName} - - !Sub arn:aws:s3:::${BulkUploadBucketName}/* + - !Join + - '' + - - 'arn:aws:s3:::' + - !Sub '{{resolve:ssm:${ParentStackName}-BulkUploadBucket}}' + - !Join + - '' + - - 'arn:aws:s3:::' + - !Sub '{{resolve:ssm:${ParentStackName}-BulkUploadBucket}}' + - '/*' + #- !Sub arn:aws:s3:::${BulkUploadBucketName} + #- !Sub arn:aws:s3:::${BulkUploadBucketName}/* - Statement: - Sid: SSMGetParameterPolicy Effect: Allow @@ -62,10 +75,24 @@ Resources: - s3:PutObject - s3:DeleteObject Resource: - - !Sub arn:aws:s3:::${BulkUploadBucketName} - - !Sub arn:aws:s3:::${BulkUploadBucketName}/* - - !Sub arn:aws:s3:::${InputBucketName} - - !Sub arn:aws:s3:::${InputBucketName}/* + - !Join + - '' + - - 'arn:aws:s3:::' + - !Sub '{{resolve:ssm:${ParentStackName}-BulkUploadBucket}}' + - !Join + - '' + - - 'arn:aws:s3:::' + - !Sub '{{resolve:ssm:${ParentStackName}-BulkUploadBucket}}' + - '/*' + - !Join + - '' + - - 'arn:aws:s3:::' + - !Sub '{{resolve:ssm:${ParentStackName}-InputBucketName}}' + - !Join + - '' + - - 'arn:aws:s3:::' + - !Sub '{{resolve:ssm:${ParentStackName}-InputBucketName}}' + - '/*' BulkQueueSpace: Type: "AWS::Serverless::Function" @@ -78,8 +105,11 @@ Resources: LogGroup: Type: AWS::Logs::LogGroup - Properties: - LogGroupName: !Sub '/aws/vendedlogs/${BulkUploadStepFunctionName}' + Properties: + LogGroupName: !Join + - '' + - - '/aws/vendedlogs/' + - !Sub "{{resolve:ssm:${ParentStackName}-BulkUploadStepFunctionName}}" RetentionInDays: 90 Role: @@ -119,7 +149,7 @@ Resources: StateMachine: Type: "AWS::StepFunctions::StateMachine" Properties: - StateMachineName: !Ref BulkUploadStepFunctionName + StateMachineName: !Sub "{{resolve:ssm:${ParentStackName}-BulkUploadStepFunctionName}}" DefinitionS3Location: ./bulk-definition.json DefinitionSubstitutions: BulkFilesCountArn: !GetAtt BulkFilesCount.Arn diff --git a/pca-server/cfn/lib/ffmpeg.template b/pca-server/cfn/lib/ffmpeg.template index aedb8778..bd48c02a 100644 --- a/pca-server/cfn/lib/ffmpeg.template +++ b/pca-server/cfn/lib/ffmpeg.template @@ -5,10 +5,13 @@ Description: Amazon Transcribe Post Call Analytics - PCA Server - FFMPEG Downloa Transform: AWS::Serverless-2016-10-31 Parameters: + ParentStackName: + Type: String + Description: Name of the parent stack - SupportFilesBucketName: - Type: AWS::SSM::Parameter::Value - Default: SupportFilesBucketName +# SupportFilesBucketName: +# Type: AWS::SSM::Parameter::Value +# Default: SupportFilesBucketName FFMPEGZipName: Type: String @@ -42,7 +45,7 @@ Resources: Resource: !Sub - 'arn:aws:s3:::${bucket}*' - - bucket: !Ref SupportFilesBucketName + - bucket: !Sub '{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}' Action: - 's3:PutObject' PolicyName: ffmpegZipFunctionS3Policy @@ -58,7 +61,7 @@ Resources: Environment: Variables: FFMPEG_DOWNLOAD_URL: !Ref ffmpegDownloadUrl - SUPPORT_FILES_BUCKET: !Ref SupportFilesBucketName + SUPPORT_FILES_BUCKET: !Sub '{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}' FFMPEG_ZIP_NAME: !Ref FFMPEGZipName Code: ZipFile: | diff --git a/pca-server/cfn/lib/glue-database.template b/pca-server/cfn/lib/glue-database.template index dd4c0d7f..e99d1c86 100644 --- a/pca-server/cfn/lib/glue-database.template +++ b/pca-server/cfn/lib/glue-database.template @@ -5,18 +5,25 @@ Description: Amazon Transcribe Post Call Analytics - PCA Server - Glue Catalog D Transform: AWS::Serverless-2016-10-31 Parameters: + ParentStackName: + Type: String + Description: Name of the parent stack - DatabaseName: - Type: AWS::SSM::Parameter::Value - Default: DatabaseName +# DatabaseName: +# Type: AWS::SSM::Parameter::Value + #Default: DatabaseName - OutputBucketName: - Type: AWS::SSM::Parameter::Value - Default: OutputBucketName - - OutputBucketParsedResults: - Type: AWS::SSM::Parameter::Value - Default: OutputBucketParsedResults +# DatabaseName: +# Type: String +# Description: Glue catalog database name used to contain tables/views for SQL integration. + +# OutputBucketName: +# Type: AWS::SSM::Parameter::Value +# Default: OutputBucketName +# +# OutputBucketParsedResults: +# Type: AWS::SSM::Parameter::Value +# Default: OutputBucketParsedResults Resources: @@ -26,8 +33,14 @@ Resources: CatalogId: !Ref AWS::AccountId DatabaseInput: Description: Post Call Analytics - LocationUri: !Sub 's3://${OutputBucketName}/${OutputBucketParsedResults}/' - Name: !Ref DatabaseName + LocationUri: !Join + - '' + - - 's3://' + - !Sub '{{resolve:ssm:${ParentStackName}-OutputBucketName}}' + - '/' + - !Sub '{{resolve:ssm:${ParentStackName}-OutputBucketParsedResults}}' + - '/' + Name: !Sub "{{resolve:ssm:${ParentStackName}-DatabaseName}}" ParsedResultsTable: Type: AWS::Glue::Table @@ -48,7 +61,13 @@ Resources: Compressed: false NumberOfBuckets: -1 InputFormat: org.apache.hadoop.mapred.TextInputFormat - Location: !Sub 's3://${OutputBucketName}/${OutputBucketParsedResults}/' + Location: !Join + - '' + - - 's3://' + - !Sub '{{resolve:ssm:${ParentStackName}-OutputBucketName}}' + - '/' + - !Sub '{{resolve:ssm:${ParentStackName}-OutputBucketParsedResults}}' + - '/' OutputFormat: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat SerdeInfo: Name: JSON diff --git a/pca-server/cfn/lib/pca.template b/pca-server/cfn/lib/pca.template index 182b17cc..bfce59ec 100644 --- a/pca-server/cfn/lib/pca.template +++ b/pca-server/cfn/lib/pca.template @@ -1,10 +1,14 @@ -AWSTemplateFormatVersion: "2010-09-09" +AWSTemplateFormatVersion: '2010-09-09' Description: Amazon Transcribe Post Call Analytics - PCA Server - PCA State Machine Transform: AWS::Serverless-2016-10-31 Parameters: + ParentStackName: + Type: String + Description: Name of the parent stack + TableName: Type: String @@ -18,33 +22,33 @@ Parameters: PyUtilsLayer: Type: String - SupportFilesBucketName: - Type: AWS::SSM::Parameter::Value - Default: SupportFilesBucketName +# SupportFilesBucketName: +# Type: AWS::SSM::Parameter::Value +# Default: SupportFilesBucketName - StepFunctionName: - Type: AWS::SSM::Parameter::Value - Default: StepFunctionName - - InputBucketName: - Type: AWS::SSM::Parameter::Value - Default: InputBucketName +# StepFunctionName: +# Type: AWS::SSM::Parameter::Value +# Default: StepFunctionName - CallSummarization: +# InputBucketName: +# Type: AWS::SSM::Parameter::Value +# Default: InputBucketName + + CallSummarization: Type: String - Default: 'DISABLED' - SummarizationSagemakerEndpointName: + Default: DISABLED + SummarizationSagemakerEndpointName: Type: String Default: '' - SummarizationSagemakerEndpointArn: + SummarizationSagemakerEndpointArn: Type: String Default: '' SummarizationLLMThirdPartyApiKey: Type: String - Description: > + Description: | Secrets manager secret Arn containing the third party LLM API key Default: '' - SummarizationLambdaFunctionArn: + SummarizationLambdaFunctionArn: Type: String Default: '' SummarizationBedrockModelId: @@ -61,20 +65,26 @@ Globals: Timeout: 60 Conditions: - ProvisionedSageMakerEndpoint: !Equals [!Ref CallSummarization, "SAGEMAKER"] - HasCustomSummarizerLambda: !Equals [!Ref CallSummarization, "LAMBDA"] - HasAnthropicSummary: !Equals [!Ref CallSummarization, "ANTHROPIC"] + ProvisionedSageMakerEndpoint: !Equals + - !Ref CallSummarization + - SAGEMAKER + HasCustomSummarizerLambda: !Equals + - !Ref CallSummarization + - LAMBDA + HasAnthropicSummary: !Equals + - !Ref CallSummarization + - ANTHROPIC Resources: FFMPEGLayer: - Type: "AWS::Lambda::LayerVersion" + Type: AWS::Lambda::LayerVersion Properties: Content: - S3Bucket: !Ref SupportFilesBucketName + S3Bucket: !Sub "{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}" S3Key: !Ref FFMPEGZipName TranscribeRole: - Type: "AWS::IAM::Role" + Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: @@ -91,7 +101,7 @@ Resources: - arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess TranscribeLambdaRole: - Type: "AWS::IAM::Role" + Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: @@ -122,8 +132,17 @@ Resources: - s3:PutObject - s3:DeleteObject Resource: - - !Sub arn:aws:s3:::${InputBucketName} - - !Sub arn:aws:s3:::${InputBucketName}/* + #- !Sub arn:aws:s3:::${InputBucketName} + #- !Sub arn:aws:s3:::${InputBucketName}/* + - !Join + - '' + - - 'arn:aws:s3:::' + - !Sub '{{resolve:ssm:${ParentStackName}-InputBucketName}}' + - !Join + - '' + - - 'arn:aws:s3:::' + - !Sub '{{resolve:ssm:${ParentStackName}-InputBucketName}}' + - '/*' - PolicyName: SSMGetParameterPolicy PolicyDocument: Statement: @@ -134,9 +153,9 @@ Resources: Resource: !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/* SFStartTranscribeJob: - Type: "AWS::Serverless::Function" + Type: AWS::Serverless::Function Properties: - CodeUri: ../../src/pca + CodeUri: ../../src/pca Handler: pca-aws-sf-start-transcribe-job.lambda_handler EphemeralStorage: Size: 4096 @@ -147,13 +166,14 @@ Resources: Environment: Variables: RoleArn: !GetAtt TranscribeRole.Arn - AWS_DATA_PATH: "/opt/models" + AWS_DATA_PATH: /opt/models + STACK_NAME: !Ref ParentStackName Role: !GetAtt TranscribeLambdaRole.Arn SFExtractJobHeader: - Type: "AWS::Serverless::Function" + Type: AWS::Serverless::Function Properties: - CodeUri: ../../src/pca + CodeUri: ../../src/pca Handler: pca-aws-sf-extract-job-header.lambda_handler MemorySize: 1024 Timeout: 900 @@ -161,16 +181,17 @@ Resources: - !Ref Boto3Layer Environment: Variables: - AWS_DATA_PATH: "/opt/models" + AWS_DATA_PATH: /opt/models + STACK_NAME: !Ref ParentStackName Policies: - arn:aws:iam::aws:policy/AmazonTranscribeReadOnlyAccess - arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess - arn:aws:iam::aws:policy/AmazonS3FullAccess SFExtractTranscriptHeader: - Type: "AWS::Serverless::Function" + Type: AWS::Serverless::Function Properties: - CodeUri: ../../src/pca + CodeUri: ../../src/pca Handler: pca-aws-sf-extract-transcript-header.lambda_handler MemorySize: 1024 Timeout: 900 @@ -179,15 +200,16 @@ Resources: - !Ref FFMPEGLayer Environment: Variables: - AWS_DATA_PATH: "/opt/models" + AWS_DATA_PATH: /opt/models + STACK_NAME: !Ref ParentStackName Policies: - arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess - arn:aws:iam::aws:policy/AmazonS3FullAccess SFProcessTurn: - Type: "AWS::Serverless::Function" + Type: AWS::Serverless::Function Properties: - CodeUri: ../../src/pca + CodeUri: ../../src/pca Handler: pca-aws-sf-process-turn-by-turn.lambda_handler MemorySize: 1024 Timeout: 900 @@ -196,7 +218,8 @@ Resources: - !Ref Boto3Layer Environment: Variables: - AWS_DATA_PATH: "/opt/models" + AWS_DATA_PATH: /opt/models + STACK_NAME: !Ref ParentStackName Policies: - arn:aws:iam::aws:policy/AmazonTranscribeReadOnlyAccess - arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess @@ -205,63 +228,69 @@ Resources: - arn:aws:iam::aws:policy/AmazonKendraFullAccess SFFinalProcessing: - Type: "AWS::Serverless::Function" + Type: AWS::Serverless::Function Properties: - CodeUri: ../../src/pca + CodeUri: ../../src/pca Handler: pca-aws-sf-post-processing.lambda_handler Layers: - !Ref Boto3Layer Environment: Variables: - AWS_DATA_PATH: "/opt/models" + AWS_DATA_PATH: /opt/models + STACK_NAME: !Ref ParentStackName Policies: - arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess - arn:aws:iam::aws:policy/AmazonS3FullAccess SFCTRGenesys: - Type: "AWS::Serverless::Function" + Type: AWS::Serverless::Function Properties: - CodeUri: ../../src/pca + CodeUri: ../../src/pca Handler: pca-aws-sf-ctr-genesys.lambda_handler Layers: - !Ref Boto3Layer Environment: Variables: - AWS_DATA_PATH: "/opt/models" + AWS_DATA_PATH: /opt/models + STACK_NAME: !Ref ParentStackName Policies: - arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess - arn:aws:iam::aws:policy/AmazonS3FullAccess SFPostCTRProcessing: - Type: "AWS::Serverless::Function" + Type: AWS::Serverless::Function Properties: - CodeUri: ../../src/pca + CodeUri: ../../src/pca Handler: pca-aws-sf-post-ctr-processing.lambda_handler Layers: - !Ref Boto3Layer Environment: Variables: - AWS_DATA_PATH: "/opt/models" + AWS_DATA_PATH: /opt/models + STACK_NAME: !Ref ParentStackName Policies: - arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess - arn:aws:iam::aws:policy/AmazonS3FullAccess - + SFFetchTranscript: - Type: "AWS::Serverless::Function" + Type: AWS::Serverless::Function Properties: Runtime: python3.11 - CodeUri: ../../src/pca + CodeUri: ../../src/pca Handler: pca-aws-fetch-transcript.lambda_handler + Environment: + Variables: + STACK_NAME: !Ref ParentStackName Timeout: 900 Policies: - arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess - arn:aws:iam::aws:policy/AmazonS3FullAccess SFSummarize: - Type: "AWS::Serverless::Function" + Type: AWS::Serverless::Function Properties: Runtime: python3.11 - CodeUri: ../../src/pca + CodeUri: ../../src/pca Handler: pca-aws-sf-summarize.lambda_handler Timeout: 900 Layers: @@ -269,7 +298,8 @@ Resources: - !Ref Boto3Layer Environment: Variables: - AWS_DATA_PATH: "/opt/models" + STACK_NAME: !Ref ParentStackName + AWS_DATA_PATH: /opt/models FETCH_TRANSCRIPT_LAMBDA_ARN: !GetAtt SFFetchTranscript.Arn BEDROCK_MODEL_ID: !Ref SummarizationBedrockModelId LLM_TABLE_NAME: !Ref LLMTableName @@ -277,9 +307,9 @@ Resources: SUMMARY_SAGEMAKER_ENDPOINT: !Ref SummarizationSagemakerEndpointName ANTHROPIC_API_KEY: !Ref SummarizationLLMThirdPartyApiKey SUMMARY_LAMBDA_ARN: !Ref SummarizationLambdaFunctionArn - ANTHROPIC_MODEL_IDENTIFIER: "claude-v1.3-100k" - ANTHROPIC_ENDPOINT_URL: "https://api.anthropic.com/v1/complete" - TOKEN_COUNT: !If + ANTHROPIC_MODEL_IDENTIFIER: claude-v1.3-100k + ANTHROPIC_ENDPOINT_URL: https://api.anthropic.com/v1/complete + TOKEN_COUNT: !If - ProvisionedSageMakerEndpoint - 1024 - 0 @@ -287,82 +317,87 @@ Resources: - arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess - arn:aws:iam::aws:policy/AmazonS3FullAccess - Statement: - - Sid: InvokeGetTranscript - Effect: Allow - Action: - - lambda:InvokeFunction - Resource: !GetAtt SFFetchTranscript.Arn - - Sid: DynamoDBAccess - Effect: Allow - Resource: !Sub arn:${AWS::Partition}:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${LLMTableName} - Action: - - 'dynamodb:GetItem' - - Sid: InvokeBedrock - Effect: Allow - Action: - - bedrock:InvokeModel - Resource: - - !Sub "arn:${AWS::Partition}:bedrock:*::foundation-model/*" - - !Sub "arn:${AWS::Partition}:bedrock:*:${AWS::AccountId}:custom-model/*" - - !If - - HasAnthropicSummary - - Sid: SecretsManagerPolicy + - Sid: InvokeGetTranscript Effect: Allow Action: - - 'secretsmanager:GetResourcePolicy' - - 'secretsmanager:GetSecretValue' - - 'secretsmanager:DescribeSecret' - - 'secretsmanager:ListSecretVersionIds' - Resource: !Ref SummarizationLLMThirdPartyApiKey - - !Ref "AWS::NoValue" - - !If - - ProvisionedSageMakerEndpoint - - Sid: InvokeSummarizer + - lambda:InvokeFunction + Resource: !GetAtt SFFetchTranscript.Arn + - Sid: DynamoDBAccess Effect: Allow + Resource: !Sub arn:${AWS::Partition}:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${LLMTableName} Action: - - sagemaker:InvokeEndpoint - Resource: !Ref SummarizationSagemakerEndpointArn - - !Ref "AWS::NoValue" - - !If - - HasCustomSummarizerLambda - - Sid: SummarizationLambda + - dynamodb:GetItem + - Sid: InvokeBedrock Effect: Allow Action: - - lambda:InvokeFunction - Resource: !Ref SummarizationLambdaFunctionArn - - !Ref "AWS::NoValue" + - bedrock:InvokeModel + Resource: + - !Sub arn:${AWS::Partition}:bedrock:*::foundation-model/* + - !Sub arn:${AWS::Partition}:bedrock:*:${AWS::AccountId}:custom-model/* + - !If + - HasAnthropicSummary + - Sid: SecretsManagerPolicy + Effect: Allow + Action: + - secretsmanager:GetResourcePolicy + - secretsmanager:GetSecretValue + - secretsmanager:DescribeSecret + - secretsmanager:ListSecretVersionIds + Resource: !Ref SummarizationLLMThirdPartyApiKey + - !Ref AWS::NoValue + - !If + - ProvisionedSageMakerEndpoint + - Sid: InvokeSummarizer + Effect: Allow + Action: + - sagemaker:InvokeEndpoint + Resource: !Ref SummarizationSagemakerEndpointArn + - !Ref AWS::NoValue + - !If + - HasCustomSummarizerLambda + - Sid: SummarizationLambda + Effect: Allow + Action: + - lambda:InvokeFunction + Resource: !Ref SummarizationLambdaFunctionArn + - !Ref AWS::NoValue SFAwaitNotification: - Type: "AWS::Serverless::Function" + Type: AWS::Serverless::Function Properties: - CodeUri: ../../src/pca + CodeUri: ../../src/pca Handler: pca-aws-sf-wait-for-transcribe-notification.lambda_handler Environment: Variables: TableName: !Ref TableName + STACK_NAME: !Ref ParentStackName Policies: - arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess SFTranscribeFailed: - Type: "AWS::Serverless::Function" + Type: AWS::Serverless::Function Properties: - CodeUri: ../../src/pca + CodeUri: ../../src/pca Handler: pca-aws-sf-transcribe-failed.lambda_handler Environment: Variables: RoleArn: !GetAtt TranscribeRole.Arn + STACK_NAME: !Ref ParentStackName Policies: - arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess - arn:aws:iam::aws:policy/AmazonS3FullAccess LogGroup: Type: AWS::Logs::LogGroup - Properties: - LogGroupName: !Sub '/aws/vendedlogs/${StepFunctionName}' + Properties: + LogGroupName: !Join + - '' + - - '/aws/vendedlogs/' + - !Sub "{{resolve:ssm:${ParentStackName}-StepFunctionName}}" RetentionInDays: 90 Role: - Type: "AWS::IAM::Role" + Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: @@ -390,22 +425,22 @@ Resources: - PolicyName: CloudWatchLogs PolicyDocument: Statement: - - Effect: Allow - Action: - - logs:CreateLogDelivery - - logs:GetLogDelivery - - logs:UpdateLogDelivery - - logs:DeleteLogDelivery - - logs:ListLogDeliveries - - logs:PutResourcePolicy - - logs:DescribeResourcePolicies - - logs:DescribeLogGroups - Resource: "*" + - Effect: Allow + Action: + - logs:CreateLogDelivery + - logs:GetLogDelivery + - logs:UpdateLogDelivery + - logs:DeleteLogDelivery + - logs:ListLogDeliveries + - logs:PutResourcePolicy + - logs:DescribeResourcePolicies + - logs:DescribeLogGroups + Resource: '*' StateMachine: - Type: "AWS::StepFunctions::StateMachine" + Type: AWS::StepFunctions::StateMachine Properties: - StateMachineName: !Ref StepFunctionName + StateMachineName: !Sub "{{resolve:ssm:${ParentStackName}-StepFunctionName}}" DefinitionS3Location: ./pca-definition.json DefinitionSubstitutions: SFExtractJobHeaderArn: !GetAtt SFExtractJobHeader.Arn diff --git a/pca-server/cfn/lib/python-utilities.template b/pca-server/cfn/lib/python-utilities.template index cd8ba09c..a8acd0e5 100644 --- a/pca-server/cfn/lib/python-utilities.template +++ b/pca-server/cfn/lib/python-utilities.template @@ -5,10 +5,13 @@ Description: Amazon Transcribe Post Call Analytics - PCA Server - Install python Transform: AWS::Serverless-2016-10-31 Parameters: + ParentStackName: + Type: String + Description: Name of the parent stack - SupportFilesBucketName: - Type: AWS::SSM::Parameter::Value - Default: SupportFilesBucketName +# SupportFilesBucketName: +# Type: AWS::SSM::Parameter::Value +# Default: SupportFilesBucketName PyZipName: Type: String @@ -36,7 +39,7 @@ Resources: Resource: !Sub - 'arn:aws:s3:::${bucket}*' - - bucket: !Ref SupportFilesBucketName + - bucket: !Sub '{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}' Action: - 's3:PutObject' PolicyName: PyUtilsZipFunctionS3Policy @@ -51,7 +54,7 @@ Resources: MemorySize: 1024 Environment: Variables: - SUPPORT_FILES_BUCKET: !Ref SupportFilesBucketName + SUPPORT_FILES_BUCKET: !Sub '{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}' PY_ZIP_NAME: !Ref PyZipName Code: ZipFile: | @@ -118,7 +121,7 @@ Resources: CompatibleRuntimes: - python3.11 Content: - S3Bucket: !Ref SupportFilesBucketName + S3Bucket: !Sub '{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}' S3Key: !Ref PyZipName Outputs: diff --git a/pca-server/cfn/lib/trigger.template b/pca-server/cfn/lib/trigger.template index 53347c70..839db848 100644 --- a/pca-server/cfn/lib/trigger.template +++ b/pca-server/cfn/lib/trigger.template @@ -5,6 +5,10 @@ Description: Amazon Transcribe Post Call Analytics - PCA Server - S3 Trigger Transform: AWS::Serverless-2016-10-31 Parameters: + ParentStackName: + Type: String + Description: Name of the parent stack + TableName: Type: String @@ -14,21 +18,21 @@ Parameters: PyUtilsLayer: Type: String - InputBucketName: - Type: AWS::SSM::Parameter::Value - Default: InputBucketName - - InputBucketRawAudio: - Type: AWS::SSM::Parameter::Value - Default: InputBucketRawAudio - - InputBucketOrigTranscripts: - Type: AWS::SSM::Parameter::Value - Default: InputBucketOrigTranscripts - - StepFunctionName: - Type: AWS::SSM::Parameter::Value - Default: StepFunctionName +# InputBucketName: +# Type: AWS::SSM::Parameter::Value +# Default: InputBucketName +# +# InputBucketRawAudio: +# Type: AWS::SSM::Parameter::Value +# Default: InputBucketRawAudio +# +# InputBucketOrigTranscripts: +# Type: AWS::SSM::Parameter::Value +# Default: InputBucketOrigTranscripts +# +# StepFunctionName: +# Type: AWS::SSM::Parameter::Value +# Default: StepFunctionName Summarize: Type: String @@ -46,6 +50,7 @@ Resources: Environment: Variables: SUMMARIZE: !Ref Summarize + STACK_NAME: !Ref ParentStackName CodeUri: ../../src/pca Handler: pca-aws-file-drop-trigger.lambda_handler Layers: @@ -60,8 +65,15 @@ Resources: - s3:ListBucket - s3:GetObject Resource: - - !Sub arn:aws:s3:::${InputBucketName} - - !Sub arn:aws:s3:::${InputBucketName}/* + - !Join + - '' + - - 'arn:aws:s3:::' + - !Sub '{{resolve:ssm:${ParentStackName}-InputBucketName}}' + - !Join + - '' + - - 'arn:aws:s3:::' + - !Sub '{{resolve:ssm:${ParentStackName}-InputBucketName}}' + - '/*' - Statement: - Sid: SSMGetParameterPolicy Effect: Allow @@ -77,7 +89,16 @@ Resources: - Sid: StartExecutionPolicy Effect: Allow Action: states:StartExecution - Resource: !Sub arn:aws:states:${AWS::Region}:${AWS::AccountId}:stateMachine:${StepFunctionName} + Resource: #!Sub arn:aws:states:${AWS::Region}:${AWS::AccountId}:stateMachine:${StepFunctionName} + - !Join + - '' + - - 'arn:aws:states:' + - !Ref 'AWS::Region' + - ':' + - !Ref 'AWS::AccountId' + - ':stateMachine:' + - !Sub '{{resolve:ssm:${ParentStackName}-StepFunctionName}}' + FileDropTriggerPermission: @@ -87,7 +108,10 @@ Resources: Action: lambda:InvokeFunction Principal: s3.amazonaws.com SourceAccount: !Ref AWS::AccountId - SourceArn: !Sub arn:aws:s3:::${InputBucketName} + SourceArn: !Join + - '' + - - 'arn:aws:s3:::' + - !Sub '{{resolve:ssm:${ParentStackName}-InputBucketName}}' ConfigureBucketRole: Type: "AWS::IAM::Role" @@ -109,7 +133,10 @@ Resources: Action: - s3:GetBucketNotification - s3:PutBucketNotification - Resource: !Sub arn:aws:s3:::${InputBucketName} + Resource: !Join + - '' + - - 'arn:aws:s3:::' + - !Sub '{{resolve:ssm:${ParentStackName}-InputBucketName}}' ConfigureBucketFunction: Type: "AWS::Lambda::Function" @@ -128,8 +155,8 @@ Resources: - FileDropTriggerPermission Properties: ServiceToken: !GetAtt ConfigureBucketFunction.Arn - BucketName: !Ref InputBucketName - Prefix: !Ref InputBucketRawAudio + BucketName: !Sub '{{resolve:ssm:${ParentStackName}-InputBucketName}}' + Prefix: !Sub '{{resolve:ssm:${ParentStackName}-InputBucketRawAudio}}' LambdaArn: !GetAtt FileDropTrigger.Arn FileUpload: "true" @@ -140,8 +167,8 @@ Resources: - ConfigureBucket Properties: ServiceToken: !GetAtt ConfigureBucketFunction.Arn - BucketName: !Ref InputBucketName - Prefix: !Ref InputBucketOrigTranscripts + BucketName: !Sub '{{resolve:ssm:${ParentStackName}-InputBucketName}}' + Prefix: !Sub '{{resolve:ssm:${ParentStackName}-InputBucketOrigTranscripts}}' LambdaArn: !GetAtt FileDropTrigger.Arn TranscribeEventbridge: @@ -180,6 +207,7 @@ Resources: Variables: TableName: !Ref TableName AWS_DATA_PATH: "/opt/models" + STACK_NAME: !Ref ParentStackName Policies: - arn:aws:iam::aws:policy/AmazonTranscribeReadOnlyAccess - Statement: diff --git a/pca-server/cfn/pca-server.template b/pca-server/cfn/pca-server.template index ecc6dac7..292a99cf 100644 --- a/pca-server/cfn/pca-server.template +++ b/pca-server/cfn/pca-server.template @@ -3,6 +3,14 @@ AWSTemplateFormatVersion: "2010-09-09" Description: Amazon Transcribe Post Call Analytics - PCA Server Parameters: + ParentStackName: + Type: String + Description: Name of the parent stack + + DatabaseName: + Type: String + Description: Glue catalog database name used to contain tables/views for SQL integration. + ffmpegDownloadUrl: Type: String Default: http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz @@ -96,6 +104,7 @@ Resources: Properties: TemplateURL: lib/ffmpeg.template Parameters: + ParentStackName: !Ref ParentStackName ffmpegDownloadUrl: !Ref ffmpegDownloadUrl BOTO3: @@ -103,6 +112,8 @@ Resources: Type: AWS::CloudFormation::Stack Properties: TemplateURL: lib/boto3.template + Parameters: + ParentStackName: !Ref ParentStackName DDB: Type: AWS::CloudFormation::Stack @@ -114,6 +125,7 @@ Resources: Properties: TemplateURL: lib/pca.template Parameters: + ParentStackName: !Ref ParentStackName TableName: !GetAtt DDB.Outputs.TableName FFMPEGZipName: !GetAtt FFMPEG.Outputs.FFMPEGZipName Boto3Layer: !If @@ -140,6 +152,7 @@ Resources: Properties: TemplateURL: lib/trigger.template Parameters: + ParentStackName: !Ref ParentStackName TableName: !GetAtt DDB.Outputs.TableName Boto3Layer: !If - ShouldCreateBoto3Layer @@ -152,11 +165,17 @@ Resources: Type: AWS::CloudFormation::Stack Properties: TemplateURL: lib/bulk.template + Parameters: + ParentStackName: !Ref ParentStackName GlueDatabase: Type: AWS::CloudFormation::Stack Properties: TemplateURL: lib/glue-database.template + Parameters: + ParentStackName: !Ref ParentStackName + #DatabaseName: !Ref DatabaseName + ########################################################################## # Transcript Summary diff --git a/pca-server/src/pca/pcaconfiguration.py b/pca-server/src/pca/pcaconfiguration.py index 47134b2d..7b7b5cf8 100644 --- a/pca-server/src/pca/pcaconfiguration.py +++ b/pca-server/src/pca/pcaconfiguration.py @@ -7,54 +7,58 @@ SPDX-License-Identifier: Apache-2.0 """ import boto3 +import os from botocore.config import Config +# Get the stack name from environment variable +STACK_NAME = os.environ.get('STACK_NAME') + # Parameter Store Field Names used by main workflow -CONF_COMP_LANGS = "ComprehendLanguages" -CONF_REDACTION_LANGS = "ContentRedactionLanguages" -CONF_CONVO_LOCATION = "ConversationLocation" -CONF_ENTITYENDPOINT = "EntityRecognizerEndpoint" -CONF_ENTITY_FILE = "EntityStringMap" -CONF_ENTITYCONF = "EntityThreshold" -CONF_ENTITY_TYPES = "EntityTypes" -CONF_PREFIX_AUDIO_PLAYBACK = "InputBucketAudioPlayback" -CONF_S3BUCKET_INPUT = "InputBucketName" -CONF_PREFIX_RAW_AUDIO = "InputBucketRawAudio" -CONF_PREFIX_FAILED_AUDIO = "InputBucketFailedTranscriptions" -CONF_PREFIX_INPUT_TRANSCRIPTS = "InputBucketOrigTranscripts" -CONF_MAX_SPEAKERS = "MaxSpeakers" -CONF_MINNEGATIVE = "MinSentimentNegative" -CONF_MINPOSITIVE = "MinSentimentPositive" -CONF_S3BUCKET_OUTPUT = "OutputBucketName" -CONF_PREFIX_TRANSCRIBE_RESULTS = "OutputBucketTranscribeResults" -CONF_PREFIX_PARSED_RESULTS = "OutputBucketParsedResults" -CONF_SPEAKER_NAMES = "SpeakerNames" -CONF_SPEAKER_MODE = "SpeakerSeparationType" -COMP_SFN_NAME = "StepFunctionName" -CONF_SUPPORT_BUCKET = "SupportFilesBucketName" -CONF_TRANSCRIBE_LANG = "TranscribeLanguages" -CONF_TELEPHONY_CTR = "TelephonyCTRType" -CONF_TELEPHONY_CTR_SUFFIX = "TelephonyCTRFileSuffix" -CONF_VOCABNAME = "VocabularyName" -CONF_CLMNAME = "CustomLangModelName" -CONF_FILENAME_DATETIME_REGEX = "FilenameDatetimeRegex" -CONF_FILENAME_DATETIME_FIELDMAP = "FilenameDatetimeFieldMap" -CONF_FILENAME_GUID_REGEX = "FilenameGUIDRegex" -CONF_FILENAME_AGENT_REGEX = "FilenameAgentRegex" -CONF_FILENAME_CUST_REGEX = "FilenameCustRegex" -CONF_FILTER_MODE = "VocabFilterMode" -CONF_FILTER_NAME = "VocabFilterName" -CONF_KENDRA_INDEX_ID = "KendraIndexId" -CONF_WEB_URI = "WebUiUri" -CONF_TRANSCRIBE_API = "TranscribeApiMode" -CONF_REDACTION_TRANSCRIPT = "CallRedactionTranscript" -CONF_REDACTION_AUDIO = "CallRedactionAudio" -CONF_CALL_SUMMARIZATION = "CallSummarization" +CONF_COMP_LANGS = f"{STACK_NAME}-ComprehendLanguages" +CONF_REDACTION_LANGS = f"{STACK_NAME}-ContentRedactionLanguages" +CONF_CONVO_LOCATION = f"{STACK_NAME}-ConversationLocation" +CONF_ENTITYENDPOINT = f"{STACK_NAME}-EntityRecognizerEndpoint" +CONF_ENTITY_FILE = f"{STACK_NAME}-EntityStringMap" +CONF_ENTITYCONF = f"{STACK_NAME}-EntityThreshold" +CONF_ENTITY_TYPES = f"{STACK_NAME}-EntityTypes" +CONF_PREFIX_AUDIO_PLAYBACK = f"{STACK_NAME}-InputBucketAudioPlayback" +CONF_S3BUCKET_INPUT = f"{STACK_NAME}-InputBucketName" +CONF_PREFIX_RAW_AUDIO = f"{STACK_NAME}-InputBucketRawAudio" +CONF_PREFIX_FAILED_AUDIO = f"{STACK_NAME}-InputBucketFailedTranscriptions" +CONF_PREFIX_INPUT_TRANSCRIPTS = f"{STACK_NAME}-InputBucketOrigTranscripts" +CONF_MAX_SPEAKERS = f"{STACK_NAME}-MaxSpeakers" +CONF_MINNEGATIVE = f"{STACK_NAME}-MinSentimentNegative" +CONF_MINPOSITIVE = f"{STACK_NAME}-MinSentimentPositive" +CONF_S3BUCKET_OUTPUT = f"{STACK_NAME}-OutputBucketName" +CONF_PREFIX_TRANSCRIBE_RESULTS = f"{STACK_NAME}-OutputBucketTranscribeResults" +CONF_PREFIX_PARSED_RESULTS = f"{STACK_NAME}-OutputBucketParsedResults" +CONF_SPEAKER_NAMES = f"{STACK_NAME}-SpeakerNames" +CONF_SPEAKER_MODE = f"{STACK_NAME}-SpeakerSeparationType" +COMP_SFN_NAME = f"{STACK_NAME}-StepFunctionName" +CONF_SUPPORT_BUCKET = f"{STACK_NAME}-SupportFilesBucketName" +CONF_TRANSCRIBE_LANG = f"{STACK_NAME}-TranscribeLanguages" +CONF_TELEPHONY_CTR = f"{STACK_NAME}-TelephonyCTRType" +CONF_TELEPHONY_CTR_SUFFIX = f"{STACK_NAME}-TelephonyCTRFileSuffix" +CONF_VOCABNAME = f"{STACK_NAME}-VocabularyName" +CONF_CLMNAME = f"{STACK_NAME}-CustomLangModelName" +CONF_FILENAME_DATETIME_REGEX = f"{STACK_NAME}-FilenameDatetimeRegex" +CONF_FILENAME_DATETIME_FIELDMAP = f"{STACK_NAME}-FilenameDatetimeFieldMap" +CONF_FILENAME_GUID_REGEX = f"{STACK_NAME}-FilenameGUIDRegex" +CONF_FILENAME_AGENT_REGEX = f"{STACK_NAME}-FilenameAgentRegex" +CONF_FILENAME_CUST_REGEX = f"{STACK_NAME}-FilenameCustRegex" +CONF_FILTER_MODE = f"{STACK_NAME}-VocabFilterMode" +CONF_FILTER_NAME = f"{STACK_NAME}-VocabFilterName" +CONF_KENDRA_INDEX_ID = f"{STACK_NAME}-KendraIndexId" +CONF_WEB_URI = f"{STACK_NAME}-WebUiUri" +CONF_TRANSCRIBE_API = f"{STACK_NAME}-TranscribeApiMode" +CONF_REDACTION_TRANSCRIPT = f"{STACK_NAME}-CallRedactionTranscript" +CONF_REDACTION_AUDIO = f"{STACK_NAME}-CallRedactionAudio" +CONF_CALL_SUMMARIZATION = f"{STACK_NAME}-CallSummarization" # Parameter store fieldnames used by bulk import -BULK_S3_BUCKET = "BulkUploadBucket" -BULK_JOB_LIMIT = "BulkUploadMaxTranscribeJobs" -BULK_MAX_DRIP_RATE = "BulkUploadMaxDripRate" +BULK_S3_BUCKET = f"{STACK_NAME}-BulkUploadBucket" +BULK_JOB_LIMIT = f"{STACK_NAME}-BulkUploadMaxTranscribeJobs" +BULK_MAX_DRIP_RATE = f"{STACK_NAME}-BulkUploadMaxDripRate" # Transcribe API Modes API_STANDARD = "standard" diff --git a/pca-ssm/.DS_Store b/pca-ssm/.DS_Store new file mode 100644 index 00000000..489fa726 Binary files /dev/null and b/pca-ssm/.DS_Store differ diff --git a/pca-ssm/cfn/ssm.template b/pca-ssm/cfn/ssm.template index d33f74ea..d6ee9551 100644 --- a/pca-ssm/cfn/ssm.template +++ b/pca-ssm/cfn/ssm.template @@ -1,46 +1,43 @@ -AWSTemplateFormatVersion: "2010-09-09" +AWSTemplateFormatVersion: '2010-09-09' Description: Amazon Transcribe Post Call Analytics - PCA SSM Parameters Parameters: + StackName: + Type: String + Description: Name of the parent stack BulkUploadBucketName: Type: String - Description: >- - (Optional) Existing bucket where files can be dropped, and a secondary Step Function can be - manually enabled to drip feed them into the system. - Leave blank to automatically create new bucket. + Description: (Optional) Existing bucket where files can be dropped, and a + secondary Step Function can be manually enabled to drip feed them into + the system. Leave blank to automatically create new bucket. BulkUploadMaxDripRate: Type: String - Default: "25" - Description: Maximum number of files that the bulk uploader will move to the PCA source bucket in one pass + Default: '25' + Description: Maximum number of files that the bulk uploader will move to the PCA + source bucket in one pass BulkUploadMaxTranscribeJobs: Type: String - Default: "50" - Description: Number of concurrent Transcribe jobs (executing or queuing) where bulk upload will pause + Default: '50' + Description: Number of concurrent Transcribe jobs (executing or queuing) where + bulk upload will pause CallSummarization: - Default: 'BEDROCK' + Default: BEDROCK Type: String AllowedValues: - - 'DISABLED' - - 'BEDROCK+TCA' - - 'BEDROCK' - - 'TCA-ONLY' - - 'SAGEMAKER' - - 'ANTHROPIC' - - 'LAMBDA' - Description: > - Set to enable call summarization by a Large Language Model. - The BEDROCK+TCA will use Transcribe Call Analytics for summarization and Bedrock for other analytics. - The BEDROCK option requires you to choose one of the supported model IDs from the provided list (SummarizationBedrockModelId). - You must also accept access to that model in the Amazon Bedrock > Model Access console. - The TCA-ONLY option will not use Bedrock, but will only use Transcribe Call Analytics summarization. - The SAGEMAKER option uses a SageMaker endpoint with the pretrained bart-large-cnn-samsum model with a ml.m5.xlarge instance type. - The LAMBDA option requires you to provide a function ARN below. - The ANTHROPIC option is a third party service, and you must enter your Anthropic API key in the Third Party LLM API Key section. + - DISABLED + - BEDROCK+TCA + - BEDROCK + - TCA-ONLY + - SAGEMAKER + - ANTHROPIC + - LAMBDA + Description: | + Set to enable call summarization by a Large Language Model. The BEDROCK+TCA will use Transcribe Call Analytics for summarization and Bedrock for other analytics. The BEDROCK option requires you to choose one of the supported model IDs from the provided list (SummarizationBedrockModelId). You must also accept access to that model in the Amazon Bedrock > Model Access console. The TCA-ONLY option will not use Bedrock, but will only use Transcribe Call Analytics summarization. The SAGEMAKER option uses a SageMaker endpoint with the pretrained bart-large-cnn-samsum model with a ml.m5.xlarge instance type. The LAMBDA option requires you to provide a function ARN below. The ANTHROPIC option is a third party service, and you must enter your Anthropic API key in the Third Party LLM API Key section. ComprehendLanguages: Type: String @@ -50,37 +47,47 @@ Parameters: ContentRedactionLanguages: Type: String Default: en-US - Description: Languages supported by Transcribe's Content Redaction feature, separated by " | " + Description: Languages supported by Transcribe's Content Redaction feature, + separated by " | " ConversationLocation: Type: String Default: America/New_York - Description: Name of the timezone location for the call source - this is the TZ database name from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones + Description: Name of the timezone location for the call source - this is the TZ + database name from + https://en.wikipedia.org/wiki/List_of_tz_database_time_zones EntityRecognizerEndpoint: Type: String Default: undefined - Description: Name of the custom entity recognizer for Amazon Comprehend (not including language suffix, e.g. -en). If one cannot be found then simple entity string matching is attempted instead + Description: Name of the custom entity recognizer for Amazon Comprehend (not + including language suffix, e.g. -en). If one cannot be found then simple + entity string matching is attempted instead EntityStringMap: Type: String Default: sample-entities.csv - Description: Basename of a CSV file containing item/Entity maps for when we don't have data for Comprehend Custom Entities (not including language suffix, e.g. -en) + Description: Basename of a CSV file containing item/Entity maps for when we + don't have data for Comprehend Custom Entities (not including language + suffix, e.g. -en) EntityThreshold: Type: String - Default: "0.5" + Default: '0.5' Description: Confidence threshold where we accept the custom entity detection result EntityTypes: Type: String - Default: PERSON | LOCATION | ORGANIZATION | COMMERCIAL_ITEM | EVENT | DATE | QUANTITY | TITLE - Description: Entity types supported by Comprehend's standard entity detection, separated by " | " + Default: PERSON | LOCATION | ORGANIZATION | COMMERCIAL_ITEM | EVENT | DATE | + QUANTITY | TITLE + Description: Entity types supported by Comprehend's standard entity detection, + separated by " | " InputBucketAudioPlayback: Type: String Default: playbackAudio - Description: Folder that holds the audio files to playback in the browser when original audio cannot be used + Description: Folder that holds the audio files to playback in the browser when + original audio cannot be used InputBucketFailedTranscriptions: Type: String @@ -89,9 +96,8 @@ Parameters: InputBucketName: Type: String - Description: >- - (Optional) Existing bucket holding all audio files for the system. - Leave blank to automatically create new bucket. + Description: (Optional) Existing bucket holding all audio files for the + system. Leave blank to automatically create new bucket. InputBucketRawAudio: Type: String @@ -101,36 +107,37 @@ Parameters: InputBucketOrigTranscripts: Type: String Default: originalTranscripts - Description: >- - Folder that holds Transcripts from other applications (e.g. Live Call Analytics) that are to be - processed as if PCA had processed that audio + Description: Folder that holds Transcripts from other applications (e.g. Live + Call Analytics) that are to be processed as if PCA had processed that + audio MaxSpeakers: Type: String - Default: "2" + Default: '2' Description: Maximum number of speakers that are expected on a call MinSentimentNegative: Type: String - Default: "2.0" - Description: Minimum sentiment level required to declare a phrase as having negative sentiment, in the range 0.0-5.0 + Default: '2.0' + Description: Minimum sentiment level required to declare a phrase as having + negative sentiment, in the range 0.0-5.0 MinSentimentPositive: Type: String - Default: "2.0" - Description: Minimum sentiment level required to declare a phrase as having positive sentiment, in the range 0.0-5.0 + Default: '2.0' + Description: Minimum sentiment level required to declare a phrase as having + positive sentiment, in the range 0.0-5.0 OutputBucketName: Type: String - Description: >- - (Optional) Existing bucket where Transcribe output files are delivered. - Leave blank to automatically create new bucket. + Description: (Optional) Existing bucket where Transcribe output files are + delivered. Leave blank to automatically create new bucket. OutputBucketTranscribeResults: Type: String Default: transcribeResults Description: Folder within the output S3 bucket where Transcribe results are written - + OutputBucketParsedResults: Type: String Default: parsedFiles @@ -139,49 +146,49 @@ Parameters: SpeakerNames: Type: String Default: Caller | Agent - Description: >- - Tags used for speaker names in transcripts, in channel/speaker order, separated by " | ". - For Call Analytics the name Agent must exist in either the first or second posision + Description: Tags used for speaker names in transcripts, in channel/speaker + order, separated by " | ". For Call Analytics the name Agent must exist in + either the first or second posision SpeakerSeparationType: Type: String Default: channel - Description: Separation mode for speakers - must be speaker (mono) channel (stereo/auto-select) + Description: Separation mode for speakers - must be speaker (mono) channel + (stereo/auto-select) StepFunctionName: Type: String - Default: PostCallAnalyticsWorkflow + #Default: PostCallAnalyticsWorkflow Description: Name of Step Functions workflow that orchestrates this process BulkUploadStepFunctionName: Type: String - Default: BulkUploadWorkflow + #Default: BulkUploadWorkflow Description: Name of Step Functions workflow that orchestrates the bulk import process SupportFilesBucketName: Type: String - Description: >- - (Optional) Existing bucket that hold supporting files, such as the - file-based entity recognition mapping files. - Leave blank to automatically create new bucket. + Description: (Optional) Existing bucket that hold supporting files, such as + the file-based entity recognition mapping files. Leave blank to + automatically create new bucket. TranscribeApiMode: Type: String Default: analytics - Description: Specifies which Transcribe API to use for new jobs - must be standard or analytics + Description: Specifies which Transcribe API to use for new jobs - must be + standard or analytics TelephonyCTRType: Type: String Default: none - Description: Type of telephony system that will deliver Contact Trace Record files along with the audio recordings + Description: Type of telephony system that will deliver Contact Trace Record + files along with the audio recordings TelephonyCTRFileSuffix: Type: String Default: none - Description: > - File number suffixes for the CTR file(s) associated with the chosen telephony type, separated by " | ". - For Genesys, this needs two entries: one for the conversation CTR file, and one for the call-specific file. - Other telephony systems may need fewer or additional entries, please consult the documentation. + Description: | + File number suffixes for the CTR file(s) associated with the chosen telephony type, separated by " | ". For Genesys, this needs two entries: one for the conversation CTR file, and one for the call-specific file. Other telephony systems may need fewer or additional entries, please consult the documentation. CallRedactionTranscript: Type: String @@ -191,486 +198,472 @@ Parameters: CallRedactionAudio: Type: String Default: true - Description: When transcript redaction is enabled in Call Analytics, only allow playback of the redacted audio + Description: When transcript redaction is enabled in Call Analytics, only allow + playback of the redacted audio TranscribeLanguages: Type: String Default: en-US - Description: Language to be used for Transcription - multiple entries separated by " | " will trigger Language Detection + Description: Language to be used for Transcription - multiple entries separated + by " | " will trigger Language Detection VocabFilterMode: Type: String Default: mask - Description: The mode to use for vocabulary filtering - must be one of mask or remove (tag is not supported) + Description: The mode to use for vocabulary filtering - must be one of mask or + remove (tag is not supported) VocabFilterName: Type: String Default: undefined - Description: Name of the vocabulary filter to use for Transcribe (not including language suffix, e.g. -en) + Description: Name of the vocabulary filter to use for Transcribe (not including + language suffix, e.g. -en) VocabularyName: Type: String Default: undefined - Description: Name of the custom vocabulary to use for Transcribe (not including language suffix, e.g. -en-US) + Description: Name of the custom vocabulary to use for Transcribe (not including + language suffix, e.g. -en-US) CustomLangModelName: Type: String Default: undefined - Description: Name of the custom language model to use for Transcribe (omit the language suffix, e.g. -en-US) + Description: Name of the custom language model to use for Transcribe (omit the + language suffix, e.g. -en-US) FilenameDatetimeRegex: Type: String - Default: '(\d{4})-(\d{2})-(\d{2})T(\d{2})-(\d{2})-(\d{2})' - Description: > - Regular Expression (regex) used to parse call Date/Time from audio filenames. - Each datetime field (year, month, etc.) must be matched using a separate parenthesized group in the regex. - Example: the regex '(\d{4})-(\d{2})-(\d{2})T(\d{2})-(\d{2})-(\d{2})' parses - the filename: CallAudioFile-2021-12-01T07-55-51.wav into a value list: [2021, 12, 01, 07, 55, 51] - The next parameter, FilenameDatetimeFieldMap, maps the values to datetime field codes. - If the filename doesn't match the regex pattern, the current time is used as the call timestamp. + Default: (\d{4})-(\d{2})-(\d{2})T(\d{2})-(\d{2})-(\d{2}) + Description: | + Regular Expression (regex) used to parse call Date/Time from audio filenames. Each datetime field (year, month, etc.) must be matched using a separate parenthesized group in the regex. Example: the regex '(\d{4})-(\d{2})-(\d{2})T(\d{2})-(\d{2})-(\d{2})' parses the filename: CallAudioFile-2021-12-01T07-55-51.wav into a value list: [2021, 12, 01, 07, 55, 51] The next parameter, FilenameDatetimeFieldMap, maps the values to datetime field codes. If the filename doesn't match the regex pattern, the current time is used as the call timestamp. FilenameDatetimeFieldMap: Type: String Default: '%Y %m %d %H %M %S' - Description: > - Space separated ordered sequence of time field codes as used by Python's datetime.strptime() function. - Each field code refers to a corresponding value parsed by the regex parameter filenameTimestampRegex. - Example: the mapping '%Y %m %d %H %M %S' assembles the regex output values [2021, 12, 01, 07, 55, 51] - into the full datetime: '2021-12-01 07:55:51'. - If the field map doesn't match the value list parsed by the regex, then the current time is used as the call timestamp. + Description: | + Space separated ordered sequence of time field codes as used by Python's datetime.strptime() function. Each field code refers to a corresponding value parsed by the regex parameter filenameTimestampRegex. Example: the mapping '%Y %m %d %H %M %S' assembles the regex output values [2021, 12, 01, 07, 55, 51] into the full datetime: '2021-12-01 07:55:51'. If the field map doesn't match the value list parsed by the regex, then the current time is used as the call timestamp. FilenameGUIDRegex: Type: String - Default: '_GUID_(.*?)_' - Description: > - Regular Expression (regex) used to parse call GUID from audio filenames. - The GUID value must be matched using a parenthesized group in the regex. - Example: the regex '_GUID_(.*?)_' parses - the filename: AutoRepairs1_CUST_12345_GUID_2a602c1a-4ca3-4d37-a933-444d575c0222_AGENT_BobS_DATETIME_07.55.51.067-09-16-2021.wav - to extract the GUID value '2a602c1a-4ca3-4d37-a933-444d575c0222'. + Default: _GUID_(.*?)_ + Description: | + Regular Expression (regex) used to parse call GUID from audio filenames. The GUID value must be matched using a parenthesized group in the regex. Example: the regex '_GUID_(.*?)_' parses the filename: AutoRepairs1_CUST_12345_GUID_2a602c1a-4ca3-4d37-a933-444d575c0222_AGENT_BobS_DATETIME_07.55.51.067-09-16-2021.wav to extract the GUID value '2a602c1a-4ca3-4d37-a933-444d575c0222'. FilenameAgentRegex: Type: String - Default: '_AGENT_(.*?)_' - Description: > - Regular Expression (regex) used to parse call AGENT from audio filenames. - The AGENT value must be matched using a parenthesized group in the regex. - Example: the regex '_AGENT_(.*?)_' parses - the filename: AutoRepairs1_CUST_12345_GUID_2a602c1a-4ca3-4d37-a933-444d575c0222_AGENT_BobS_DATETIME_07.55.51.067-09-16-2021.wav - to extract the AGENT value 'BobS'. - + Default: _AGENT_(.*?)_ + Description: | + Regular Expression (regex) used to parse call AGENT from audio filenames. The AGENT value must be matched using a parenthesized group in the regex. Example: the regex '_AGENT_(.*?)_' parses the filename: AutoRepairs1_CUST_12345_GUID_2a602c1a-4ca3-4d37-a933-444d575c0222_AGENT_BobS_DATETIME_07.55.51.067-09-16-2021.wav to extract the AGENT value 'BobS'. + FilenameCustRegex: Type: String - Default: '_CUST_(.*?)_' - Description: > - Regular Expression (regex) used to parse Customer from audio filenames. - The customer id value must be matched using one or more parenthesized groups in the regex. - Example: the regex '_CUST_(.*?)_' parses - the filename: AutoRepairs1_CUST_12345_GUID_2a602c1a-4ca3-4d37-a933-444d575c0222_AGENT_BobS_DATETIME_07.55.51.067-09-16-2021.wav - to extract the Customer value '12345'. + Default: _CUST_(.*?)_ + Description: | + Regular Expression (regex) used to parse Customer from audio filenames. The customer id value must be matched using one or more parenthesized groups in the regex. Example: the regex '_CUST_(.*?)_' parses the filename: AutoRepairs1_CUST_12345_GUID_2a602c1a-4ca3-4d37-a933-444d575c0222_AGENT_BobS_DATETIME_07.55.51.067-09-16-2021.wav to extract the Customer value '12345'. KendraIndexId: Type: String - Description: Kendra Index ID, or empty string if call transcription indexing is not enabled - + Description: Kendra Index ID, or empty string if call transcription indexing is + not enabled + #WebUri: # Type: String # Description: PCA Web Application URI - + DatabaseName: Type: String - Default: 'pca' - Description: Glue catalog database name used to contain tables/views for SQL integration. - + Description: Glue catalog database name used to contain tables/views for SQL + integration. + Resources: BulkUploadBucketParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: BulkUploadBucket + Name: !Sub ${StackName}-BulkUploadBucket Type: String - Description: Bucket where files can be dropped, and a secondary Step Function can be manually enabled to drip feed them into the system + Description: Bucket where files can be dropped, and a secondary Step Function + can be manually enabled to drip feed them into the system Value: !Ref BulkUploadBucketName BulkUploadMaxDripRateParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: BulkUploadMaxDripRate + Name: !Sub ${StackName}-BulkUploadMaxDripRate Type: String - Description: Maximum number of files that the bulk uploader will move to the PCA source bucket in one pass + Description: Maximum number of files that the bulk uploader will move to the PCA + source bucket in one pass Value: !Ref BulkUploadMaxDripRate BulkUploadMaxTranscribeJobsParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: BulkUploadMaxTranscribeJobs + Name: !Sub ${StackName}-BulkUploadMaxTranscribeJobs Type: String - Description: Number of concurrent Transcribe jobs (executing or queuing) where bulk upload will pause + Description: Number of concurrent Transcribe jobs (executing or queuing) where + bulk upload will pause Value: !Ref BulkUploadMaxTranscribeJobs CallSummarizationParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: CallSummarization + Name: !Sub ${StackName}-CallSummarization Type: String - Description: >- - What type of call summarization to use. + Description: 'What type of call summarization to use. ' Value: !Ref CallSummarization ComprehendLanguagesParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: ComprehendLanguages + Name: !Sub ${StackName}-ComprehendLanguages Type: String Description: Languages supported by Comprehend's standard calls, separated by " | " Value: !Ref ComprehendLanguages ContentRedactionLanguagesParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: ContentRedactionLanguages + Name: !Sub ${StackName}-ContentRedactionLanguages Type: String - Description: Languages supported by Transcribe's Content Redaction feature, separated by " | " + Description: Languages supported by Transcribe's Content Redaction feature, + separated by " | " Value: !Ref ContentRedactionLanguages ConversationLocationParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: ConversationLocation + Name: !Sub ${StackName}-ConversationLocation Type: String - Description: Name of the timezone location for the call source - this is the TZ database name from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones + Description: Name of the timezone location for the call source - this is the TZ + database name from + https://en.wikipedia.org/wiki/List_of_tz_database_time_zones Value: !Ref ConversationLocation EntityRecognizerEndpointParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: EntityRecognizerEndpoint + Name: !Sub ${StackName}-EntityRecognizerEndpoint Type: String - Description: Name of the custom entity recognizer for Amazon Comprehend (not including language suffix, e.g. -en). If one cannot be found then simple entity string matching is attempted instead + Description: Name of the custom entity recognizer for Amazon Comprehend (not + including language suffix, e.g. -en). If one cannot be found then simple + entity string matching is attempted instead Value: !Ref EntityRecognizerEndpoint EntityStringMapParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: EntityStringMap + Name: !Sub ${StackName}-EntityStringMap Type: String - Description: Basename of a CSV file containing item/Entity maps for when we don't have data for Comprehend Custom Entities (not including language suffix, e.g. -en) + Description: Basename of a CSV file containing item/Entity maps for when we + don't have data for Comprehend Custom Entities (not including language + suffix, e.g. -en) Value: !Ref EntityStringMap EntityThresholdParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: EntityThreshold + Name: !Sub ${StackName}-EntityThreshold Type: String Description: Confidence threshold where we accept the custom entity detection result Value: !Ref EntityThreshold EntityTypesParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: EntityTypes + Name: !Sub ${StackName}-EntityTypes Type: String - Description: Entity types supported by Comprehend's standard entity detection, separated by " | " + Description: Entity types supported by Comprehend's standard entity detection, + separated by " | " Value: !Ref EntityTypes InputBucketAudioPlaybackParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: InputBucketAudioPlayback + Name: !Sub ${StackName}-InputBucketAudioPlayback Type: String - Description: Folder that holds the audio to playback in the browser when original audio cannot be used + Description: Folder that holds the audio to playback in the browser when + original audio cannot be used Value: !Ref InputBucketAudioPlayback InputBucketFailedTranscriptionsParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: InputBucketFailedTranscriptions + Name: !Sub ${StackName}-InputBucketFailedTranscriptions Type: String Description: Folder that holds audio files that for some reason failed transcription Value: !Ref InputBucketFailedTranscriptions InputBucketNameParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: InputBucketName + Name: !Sub ${StackName}-InputBucketName Type: String Description: Bucket where where audio files are delivered Value: !Ref InputBucketName InputBucketRawAudioParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: InputBucketRawAudio + Name: !Sub ${StackName}-InputBucketRawAudio Type: String Description: Folder that holds the original call audio to be ingested Value: !Ref InputBucketRawAudio InputBucketOrigTranscriptsParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: InputBucketOrigTranscripts + Name: !Sub ${StackName}-InputBucketOrigTranscripts Type: String - Description: > - Folder that holds Transcripts from other applications (e.g. Live Call Analytics) that are to be - processed as if PCA had processed that audio + Description: | + Folder that holds Transcripts from other applications (e.g. Live Call Analytics) that are to be processed as if PCA had processed that audio Value: !Ref InputBucketOrigTranscripts MaxSpeakersParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: MaxSpeakers + Name: !Sub ${StackName}-MaxSpeakers Type: String Description: Maximum number of speakers that are expected on a call Value: !Ref MaxSpeakers MinSentimentNegativeParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: MinSentimentNegative + Name: !Sub ${StackName}-MinSentimentNegative Type: String - Description: Minimum sentiment level required to declare a phrase as having negative sentiment + Description: Minimum sentiment level required to declare a phrase as having + negative sentiment Value: !Ref MinSentimentNegative MinSentimentPositiveParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: MinSentimentPositive + Name: !Sub ${StackName}-MinSentimentPositive Type: String - Description: Minimum sentiment level required to declare a phrase as having positive sentiment + Description: Minimum sentiment level required to declare a phrase as having + positive sentiment Value: !Ref MinSentimentPositive OutputBucketNameParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: OutputBucketName + Name: !Sub ${StackName}-OutputBucketName Type: String Description: Bucket where Transcribe output files are delivered Value: !Ref OutputBucketName OutputBucketTranscribeResultsParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: OutputBucketTranscribeResults + Name: !Sub ${StackName}-OutputBucketTranscribeResults Type: String Description: Folder within the output S3 bucket where Transcribe results are written - Value: !Ref OutputBucketTranscribeResults + Value: !Ref OutputBucketTranscribeResults OutputBucketParsedResultsParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: OutputBucketParsedResults + Name: !Sub ${StackName}-OutputBucketParsedResults Type: String Description: Folder within the output S3 bucket where parsed results are written Value: !Ref OutputBucketParsedResults SpeakerNamesParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: SpeakerNames + Name: !Sub ${StackName}-SpeakerNames Type: String Description: Default tags used for speaker names, separated by " | " Value: !Ref SpeakerNames SpeakerSeparationTypeParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: SpeakerSeparationType + Name: !Sub ${StackName}-SpeakerSeparationType Type: String - Description: Separation mode for speakers, either explicitly Speaker or Channel, or Auto where audio stereo=>Channel and mono=>Speaker + Description: Separation mode for speakers, either explicitly Speaker or Channel, + or Auto where audio stereo=>Channel and mono=>Speaker Value: !Ref SpeakerSeparationType StepFunctionNameParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: StepFunctionName + Name: !Sub ${StackName}-StepFunctionName Type: String Description: Name of Step Functions workflow that orchestrates this process - Value: !Ref StepFunctionName + Value: !Sub ${StackName}-${StepFunctionName} BulkUploadStepFunctionNameParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: BulkUploadStepFunctionName + Name: !Sub ${StackName}-BulkUploadStepFunctionName Type: String Description: Name of Step Functions workflow that orchestrates the bulk import process - Value: !Ref BulkUploadStepFunctionName - + Value: !Sub ${StackName}-${BulkUploadStepFunctionName} + SupportFilesBucketNameParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: SupportFilesBucketName + Name: !Sub ${StackName}-SupportFilesBucketName Type: String - Description: Bucket that hold supporting files, such as the file-based entity recognition mapping files + Description: Bucket that hold supporting files, such as the file-based entity + recognition mapping files Value: !Ref SupportFilesBucketName TranscribeApiModeParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: TranscribeApiMode + Name: !Sub ${StackName}-TranscribeApiMode Type: String - Description: Specifies which Transcribe API to use for new jobs - must be standard or analytics + Description: Specifies which Transcribe API to use for new jobs - must be + standard or analytics Value: !Ref TranscribeApiMode TelephonyCTRTypeParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: TelephonyCTRType + Name: !Sub ${StackName}-TelephonyCTRType Type: String - Description: Type of telephony system that will deliver Contact Trace Record files along with the audio recordings + Description: Type of telephony system that will deliver Contact Trace Record + files along with the audio recordings Value: !Ref TelephonyCTRType TelephonyCTRFileSuffixParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: TelephonyCTRFileSuffix + Name: !Sub ${StackName}-TelephonyCTRFileSuffix Type: String - Description: > - File name suffixes for the CTR file(s) associated with the chosen telephony type, separated by " | ". - For Genesys, this needs two entries: one for the conversation CTR file, and one for the call-specific file. - Other telephony systems may need fewer or additional entries, please consult the documentation.rdings + Description: | + File name suffixes for the CTR file(s) associated with the chosen telephony type, separated by " | ". For Genesys, this needs two entries: one for the conversation CTR file, and one for the call-specific file. Other telephony systems may need fewer or additional entries, please consult the documentation.rdings Value: !Ref TelephonyCTRFileSuffix CallRedactionTranscriptParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: CallRedactionTranscript + Name: !Sub ${StackName}-CallRedactionTranscript Type: String Description: Enable or disable Transcribe's redaction feature Value: !Ref CallRedactionTranscript CallRedactionAudioParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: CallRedactionAudio + Name: !Sub ${StackName}-CallRedactionAudio Type: String - Description: When transcript redaction is enabled in Call Analytics, only allow playback of the redacted audio + Description: When transcript redaction is enabled in Call Analytics, only allow + playback of the redacted audio Value: !Ref CallRedactionAudio TranscribeLanguagesParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: TranscribeLanguages + Name: !Sub ${StackName}-TranscribeLanguages Type: String - Description: Language to be used for Transcription - multiple entries separated by " | " will trigger Language Detection + Description: Language to be used for Transcription - multiple entries separated + by " | " will trigger Language Detection Value: !Ref TranscribeLanguages VocabFilterModeParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: VocabFilterMode + Name: !Sub ${StackName}-VocabFilterMode Type: String - Description: The mode to use for vocabulary filtering - must be one of mask or remove (tag is not supported) + Description: The mode to use for vocabulary filtering - must be one of mask or + remove (tag is not supported) Value: !Ref VocabFilterMode VocabFilterNameParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: VocabFilterName + Name: !Sub ${StackName}-VocabFilterName Type: String - Description: Name of the vocabulary filter to use for Transcribe (not including language suffix, e.g. -en-US) + Description: Name of the vocabulary filter to use for Transcribe (not including + language suffix, e.g. -en-US) Value: !Ref VocabFilterName VocabularyNameParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: VocabularyName + Name: !Sub ${StackName}-VocabularyName Type: String - Description: Name of the custom vocabulary to use for Transcribe (not including language suffix, e.g. -en-US) + Description: Name of the custom vocabulary to use for Transcribe (not including + language suffix, e.g. -en-US) Value: !Ref VocabularyName CustomLangModelNameParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: CustomLangModelName + Name: !Sub ${StackName}-CustomLangModelName Type: String - Description: Name of the custom language model to use for Transcribe (omit the language suffix, e.g. -en-US) + Description: Name of the custom language model to use for Transcribe (omit the + language suffix, e.g. -en-US) Value: !Ref CustomLangModelName FilenameDatetimeRegexParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: FilenameDatetimeRegex + Name: !Sub ${StackName}-FilenameDatetimeRegex Type: String Value: !Ref FilenameDatetimeRegex - Description: > - Regular Expression (regex) used to parse call Date/Time from audio filenames. - Each datetime field (year, month, etc.) must be matched using a separate parenthesized group in the regex. - Example: the regex '(\d{2}).(\d{2}).(\d{2}).(\d{3})-(\d{2})-(\d{2})-(\d{4})' parses - the filename: CallAudioFile-09.25.51.067-09-26-2019.wav into a value list: [09, 25, 51, 067, 09, 26, 2019] - The next parameter, FilenameDatetimeFieldMap, maps the values to datetime field codes. - If the filename doesn't match the regex pattern, the current time is used as the call timestamp. + Description: | + Regular Expression (regex) used to parse call Date/Time from audio filenames. Each datetime field (year, month, etc.) must be matched using a separate parenthesized group in the regex. Example: the regex '(\d{2}).(\d{2}).(\d{2}).(\d{3})-(\d{2})-(\d{2})-(\d{4})' parses the filename: CallAudioFile-09.25.51.067-09-26-2019.wav into a value list: [09, 25, 51, 067, 09, 26, 2019] The next parameter, FilenameDatetimeFieldMap, maps the values to datetime field codes. If the filename doesn't match the regex pattern, the current time is used as the call timestamp. FilenameDatetimeFieldMapParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: FilenameDatetimeFieldMap + Name: !Sub ${StackName}-FilenameDatetimeFieldMap Type: String Value: !Ref FilenameDatetimeFieldMap - Description: > - Space separated ordered sequence of time field codes as used by Python's datetime.strptime() function. - Each field code refers to a corresponding value parsed by the regex parameter filenameTimestampRegex. - Example: the mapping '%H %M %S %f %m %d %Y' assembles the regex output values [09, 25, 51, 067, 09, 26, 2019] - into the full datetime: '2019-09-26 09:25:51.067000'. - If the field map doesn't match the value list parsed by the regex, then the current time is used as the call timestamp. + Description: | + Space separated ordered sequence of time field codes as used by Python's datetime.strptime() function. Each field code refers to a corresponding value parsed by the regex parameter filenameTimestampRegex. Example: the mapping '%H %M %S %f %m %d %Y' assembles the regex output values [09, 25, 51, 067, 09, 26, 2019] into the full datetime: '2019-09-26 09:25:51.067000'. If the field map doesn't match the value list parsed by the regex, then the current time is used as the call timestamp. FilenameGUIDRegexParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: FilenameGUIDRegex + Name: !Sub ${StackName}-FilenameGUIDRegex Type: String Value: !Ref FilenameGUIDRegex - Description: > - Regular Expression (regex) used to parse call GUID from audio filenames. - The GUID value must be matched using one or more parenthesized groups in the regex. - Example: the regex '_GUID_(.*?)_' parses - the filename: AutoRepairs1_CUST_12345_GUID_2a602c1a-4ca3-4d37-a933-444d575c0222_AGENT_BobS_DATETIME_07.55.51.067-09-16-2021.wav - to extract the GUID value '2a602c1a-4ca3-4d37-a933-444d575c0222'. + Description: | + Regular Expression (regex) used to parse call GUID from audio filenames. The GUID value must be matched using one or more parenthesized groups in the regex. Example: the regex '_GUID_(.*?)_' parses the filename: AutoRepairs1_CUST_12345_GUID_2a602c1a-4ca3-4d37-a933-444d575c0222_AGENT_BobS_DATETIME_07.55.51.067-09-16-2021.wav to extract the GUID value '2a602c1a-4ca3-4d37-a933-444d575c0222'. FilenameAgentRegexParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: FilenameAgentRegex + Name: !Sub ${StackName}-FilenameAgentRegex Type: String Value: !Ref FilenameAgentRegex - Description: > - Regular Expression (regex) used to parse call AGENT from audio filenames. - The AGENT value must be matched using one or more parenthesized groups in the regex. - Example: the regex '_AGENT_(.*?)_' parses - the filename: AutoRepairs1_CUST_12345_GUID_2a602c1a-4ca3-4d37-a933-444d575c0222_AGENT_BobS_DATETIME_07.55.51.067-09-16-2021.wav - to extract the AGENT value 'BobS'. + Description: | + Regular Expression (regex) used to parse call AGENT from audio filenames. The AGENT value must be matched using one or more parenthesized groups in the regex. Example: the regex '_AGENT_(.*?)_' parses the filename: AutoRepairs1_CUST_12345_GUID_2a602c1a-4ca3-4d37-a933-444d575c0222_AGENT_BobS_DATETIME_07.55.51.067-09-16-2021.wav to extract the AGENT value 'BobS'. FilenameCustRegexParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: FilenameCustRegex + Name: !Sub ${StackName}-FilenameCustRegex Type: String Value: !Ref FilenameCustRegex - Description: > - Regular Expression (regex) used to parse Customer from audio filenames. - The customer id value must be matched using one or more parenthesized groups in the regex. - Example: the regex '_CUST_(.*?)_' parses - the filename: AutoRepairs1_CUST_12345_GUID_2a602c1a-4ca3-4d37-a933-444d575c0222_AGENT_BobS_DATETIME_07.55.51.067-09-16-2021.wav - to extract the Customer value '12345'. + Description: | + Regular Expression (regex) used to parse Customer from audio filenames. The customer id value must be matched using one or more parenthesized groups in the regex. Example: the regex '_CUST_(.*?)_' parses the filename: AutoRepairs1_CUST_12345_GUID_2a602c1a-4ca3-4d37-a933-444d575c0222_AGENT_BobS_DATETIME_07.55.51.067-09-16-2021.wav to extract the Customer value '12345'. KendraIndexIdParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: KendraIndexId + Name: !Sub ${StackName}-KendraIndexId Type: String Value: !Ref KendraIndexId - Description: Kendra Index ID, or empty string if call transcription indexing is not enabled - + Description: Kendra Index ID, or empty string if call transcription indexing is + not enabled + #WebUriParameter: # Type: "AWS::SSM::Parameter" # Properties: - # Name: WebUri + # Name: !Sub '${StackName}-WebUri' # Type: String # Value: !Ref WebUri # Description: PCA Web Application URI DatabaseNameParameter: - Type: "AWS::SSM::Parameter" + Type: AWS::SSM::Parameter Properties: - Name: DatabaseName + Name: !Sub ${StackName}-DatabaseName Type: String Value: !Ref DatabaseName - Description: PCA Glue catalog database name + Description: PCA Glue catalog database name \ No newline at end of file diff --git a/pca-ui/cfn/pca-ui.template b/pca-ui/cfn/pca-ui.template index 094bb9cb..00cfeb9b 100644 --- a/pca-ui/cfn/pca-ui.template +++ b/pca-ui/cfn/pca-ui.template @@ -3,6 +3,10 @@ AWSTemplateFormatVersion: "2010-09-09" Description: Amazon Transcribe Post Call Analytics - PCA UI Parameters: + ParentStackName: + Type: String + Description: Name of the parent stack + AdminUsername: Type: String Default: "admin" @@ -201,7 +205,7 @@ Resources: WebUriParameter: Type: "AWS::SSM::Parameter" Properties: - Name: WebUiUri + Name: !Sub ${ParentStackName}-WebUiUri Type: String Value: !GetAtt Web.Outputs.Uri Description: PCA Web Application URI