Skip to content

Commit fbd4d0b

Browse files
committed
Merge branch 'develop' v0.7.11
2 parents 437f206 + de45f39 commit fbd4d0b

File tree

8 files changed

+201
-21
lines changed

8 files changed

+201
-21
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.7.11] - 2024-10-09
11+
12+
### Added
13+
- Disable checking if Bedrock models are enabled (default is set to true i.e check it which is the right setting for most cases).
14+
- Allow users to sign-up for access to Web UI when AllowedSignUpEmailDomain is populated (disable if left blank. enabled for all domains if * is entered).
15+
1016
## [0.7.10] - 2024-08-12
1117

1218
### Added
@@ -269,6 +275,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
269275
- Initial release
270276

271277
[Unreleased]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/compare/main...develop
278+
[0.7.11]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.11
279+
[0.7.10]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.10
272280
[0.7.9]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.9
273281
[0.7.8]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.8
274282
[0.7.7]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.7.7

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ OR, if you opted to follow the steps above to Build and Publish PCA CloudFormati
191191
* For **Stack name**, use the default value, ``PostCallAnalytics``.
192192
* For **AdminUsername,** use the default value, `admin`.
193193
* For **AdminEmail,** use a valid email address—your temporary password is emailed to this address during the deployment.
194+
* For **AllowedSignUpEmailDomain** Email address domain (example.com) or comma separated list of email domains (example1.com, example2.com) allowed to signin and signup using the web UI. To allow signup from any domain, enter *. If left empty, signup via the web UI is disabled and users will have to be created using Cognito.
194195
* For **loadSampleAudioFiles**, change the value to `true`.
195196
* For **EnableTranscriptKendraSearch**, change the value to ``Yes, create new Kendra Index (Developer Edition)``.
196197

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.7.10
1+
0.7.11

pca-main-nokendra.template

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AWSTemplateFormatVersion: "2010-09-09"
22

3-
Description: Amazon Transcribe Post Call Analytics - PCA (v0.7.10) (uksb-1sn29lk73, SO9071)
3+
Description: Amazon Transcribe Post Call Analytics - PCA (v0.7.11) (uksb-1sn29lk73, SO9071)
44

55
Parameters:
66

@@ -17,6 +17,18 @@ Parameters:
1717
AllowedPattern: ".+\\@.+\\..+"
1818
ConstraintDescription: Must be valid email address eg. [email protected]
1919

20+
AllowedSignUpEmailDomain:
21+
Type: String
22+
Default: ""
23+
Description: >-
24+
Email address domain (example.com) or comma separated list of email domains (example1.com,
25+
example2.com) allowed to signin and signup using the web UI. To allow signup from any domain,
26+
enter *.
27+
If left empty, signup via the web UI is disabled and users will have to be created
28+
using
29+
Cognito.
30+
AllowedPattern: '^(\*||([\w-]+\.)+[\w-]{2,6}(, *([\w-]+\.)+[\w-]{2,6})*)$'
31+
2032
BulkUploadBucketName:
2133
Type: String
2234
Default: ""
@@ -415,6 +427,15 @@ Parameters:
415427
- anthropic.claude-v2
416428
Description: (Optional) If 'CallSummarization' is BEDROCK, which Bedrock model to use.
417429

430+
TestBedrockModelId:
431+
Type: String
432+
Default: true
433+
AllowedValues:
434+
- true
435+
- false
436+
Description: >
437+
Set to false to disable checking if the Bedrock models are enabled.
438+
418439
SummarizationSageMakerInitialInstanceCount:
419440
Type: Number
420441
MinValue: 0
@@ -444,6 +465,7 @@ Metadata:
444465
Parameters:
445466
- AdminUsername
446467
- AdminEmail
468+
- AllowedSignUpEmailDomain
447469
- Label:
448470
default: Sample Data
449471
Parameters:
@@ -545,6 +567,7 @@ Metadata:
545567
- Environment
546568
- StepFunctionName
547569
- ffmpegDownloadUrl
570+
- TestBedrockModelId
548571

549572
Conditions:
550573
ShouldCreateBulkUploadBucket: !Equals [!Ref BulkUploadBucketName, '']
@@ -563,14 +586,24 @@ Conditions:
563586
!Equals [!Ref GenAIQuery, 'BEDROCK'],
564587
]
565588
ShouldDeployLLMThirdPartyApiKey: !And [!Not [!Equals [!Ref SummarizationLLMThirdPartyApiKey, '']], !Not [!Equals [!Ref SummarizationLLMThirdPartyApiKey, undefined]]]
566-
ShouldTestBedrockModelId: !Or [
567-
!Equals [!Ref CallSummarization, 'BEDROCK'],
568-
!Equals [!Ref CallSummarization, "BEDROCK+TCA"],
569-
!Equals [!Ref GenAIQuery, 'BEDROCK'],]
570-
ShouldTestGenAIQueryBedrockModelId: !Equals [!Ref GenAIQuery, 'BEDROCK']
571-
ShouldTestSummarizationBedrockModelId: !Or [
572-
!Equals [!Ref CallSummarization, 'BEDROCK'],
573-
!Equals [!Ref CallSummarization, "BEDROCK+TCA"],
589+
ShouldTestBedrockModelId: !And [
590+
!Or [
591+
!Equals [!Ref CallSummarization, 'BEDROCK'],
592+
!Equals [!Ref CallSummarization, "BEDROCK+TCA"],
593+
!Equals [!Ref GenAIQuery, 'BEDROCK'],
594+
],
595+
!Equals [!Ref TestBedrockModelId, 'true']
596+
]
597+
ShouldTestGenAIQueryBedrockModelId: !And [
598+
!Equals [!Ref GenAIQuery, 'BEDROCK'],
599+
!Equals [!Ref TestBedrockModelId, 'true']
600+
]
601+
ShouldTestSummarizationBedrockModelId: !And [
602+
!Or [
603+
!Equals [!Ref CallSummarization, 'BEDROCK'],
604+
!Equals [!Ref CallSummarization, "BEDROCK+TCA"],
605+
],
606+
!Equals [!Ref TestBedrockModelId, 'true']
574607
]
575608

576609
Resources:
@@ -935,6 +968,7 @@ Resources:
935968
Parameters:
936969
AdminUsername: !Ref AdminUsername
937970
AdminEmail: !Ref AdminEmail
971+
AllowedSignUpEmailDomain: !Ref AllowedSignUpEmailDomain
938972
MainStackName: !Ref AWS::StackName
939973
AudioBucket:
940974
!If

pca-main.template

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AWSTemplateFormatVersion: "2010-09-09"
22

3-
Description: Amazon Transcribe Post Call Analytics - PCA (v0.7.10) (uksb-1sn29lk73, SO9071)
3+
Description: Amazon Transcribe Post Call Analytics - PCA (v0.7.11) (uksb-1sn29lk73, SO9071)
44

55
Parameters:
66

@@ -17,6 +17,18 @@ Parameters:
1717
AllowedPattern: ".+\\@.+\\..+"
1818
ConstraintDescription: Must be valid email address eg. [email protected]
1919

20+
AllowedSignUpEmailDomain:
21+
Type: String
22+
Default: ""
23+
Description: >-
24+
Email address domain (example.com) or comma separated list of email domains (example1.com,
25+
example2.com) allowed to signin and signup using the web UI. To allow signup from any domain,
26+
enter *.
27+
If left empty, signup via the web UI is disabled and users will have to be created
28+
using
29+
Cognito.
30+
AllowedPattern: '^(\*||([\w-]+\.)+[\w-]{2,6}(, *([\w-]+\.)+[\w-]{2,6})*)$'
31+
2032
BulkUploadBucketName:
2133
Type: String
2234
Default: ""
@@ -456,6 +468,15 @@ Parameters:
456468
- anthropic.claude-v2
457469
Description: (Optional) If 'CallSummarization' is BEDROCK, which Bedrock model to use.
458470

471+
TestBedrockModelId:
472+
Type: String
473+
Default: true
474+
AllowedValues:
475+
- true
476+
- false
477+
Description: >
478+
Set to false to disable checking if the Bedrock models are enabled.
479+
459480
SummarizationSageMakerInitialInstanceCount:
460481
Type: Number
461482
MinValue: 0
@@ -485,6 +506,7 @@ Metadata:
485506
Parameters:
486507
- AdminUsername
487508
- AdminEmail
509+
- AllowedSignUpEmailDomain
488510
- Label:
489511
default: Sample Data
490512
Parameters:
@@ -586,6 +608,7 @@ Metadata:
586608
- Environment
587609
- StepFunctionName
588610
- ffmpegDownloadUrl
611+
- TestBedrockModelId
589612

590613
Conditions:
591614
ShouldCreateBulkUploadBucket: !Equals [!Ref BulkUploadBucketName, '']
@@ -604,14 +627,24 @@ Conditions:
604627
!Equals [!Ref GenAIQuery, 'BEDROCK'],
605628
]
606629
ShouldDeployLLMThirdPartyApiKey: !And [!Not [!Equals [!Ref SummarizationLLMThirdPartyApiKey, '']], !Not [!Equals [!Ref SummarizationLLMThirdPartyApiKey, undefined]]]
607-
ShouldTestBedrockModelId: !Or [
608-
!Equals [!Ref CallSummarization, 'BEDROCK'],
609-
!Equals [!Ref CallSummarization, "BEDROCK+TCA"],
610-
!Equals [!Ref GenAIQuery, 'BEDROCK'],]
611-
ShouldTestGenAIQueryBedrockModelId: !Equals [!Ref GenAIQuery, 'BEDROCK']
612-
ShouldTestSummarizationBedrockModelId: !Or [
613-
!Equals [!Ref CallSummarization, 'BEDROCK'],
614-
!Equals [!Ref CallSummarization, "BEDROCK+TCA"],
630+
ShouldTestBedrockModelId: !And [
631+
!Or [
632+
!Equals [!Ref CallSummarization, 'BEDROCK'],
633+
!Equals [!Ref CallSummarization, "BEDROCK+TCA"],
634+
!Equals [!Ref GenAIQuery, 'BEDROCK'],
635+
],
636+
!Equals [!Ref TestBedrockModelId, 'true']
637+
]
638+
ShouldTestGenAIQueryBedrockModelId: !And [
639+
!Equals [!Ref GenAIQuery, 'BEDROCK'],
640+
!Equals [!Ref TestBedrockModelId, 'true']
641+
]
642+
ShouldTestSummarizationBedrockModelId: !And [
643+
!Or [
644+
!Equals [!Ref CallSummarization, 'BEDROCK'],
645+
!Equals [!Ref CallSummarization, "BEDROCK+TCA"],
646+
],
647+
!Equals [!Ref TestBedrockModelId, 'true']
615648
]
616649

617650
Rules:
@@ -1119,6 +1152,7 @@ Resources:
11191152
Parameters:
11201153
AdminUsername: !Ref AdminUsername
11211154
AdminEmail: !Ref AdminEmail
1155+
AllowedSignUpEmailDomain: !Ref AllowedSignUpEmailDomain
11221156
MainStackName: !Ref AWS::StackName
11231157
AudioBucket:
11241158
!If

pca-ui/cfn/lib/cognito.template

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
AWSTemplateFormatVersion: "2010-09-09"
2+
Transform: AWS::Serverless-2016-10-31
23

34
Description: Amazon Transcribe Post Call Analytics - PCA UI - Cognito
45

@@ -10,6 +11,18 @@ Parameters:
1011
AdminEmail:
1112
Type: String
1213

14+
AllowedSignUpEmailDomain:
15+
Type: String
16+
Default: ""
17+
Description: >-
18+
Email address domain (example.com) or comma separated list of email domains (example1.com,
19+
example2.com) allowed to signin and signup using the web UI. To allow signup from any domain,
20+
enter *.
21+
If left empty, signup via the web UI is disabled and users will have to be created
22+
using
23+
Cognito.
24+
AllowedPattern: '^(\*||([\w-]+\.)+[\w-]{2,6}(, *([\w-]+\.)+[\w-]{2,6})*)$'
25+
1326
Name:
1427
Type: String
1528

@@ -19,9 +32,17 @@ Parameters:
1932
Environment:
2033
Type: String
2134

35+
CloudWatchLogsExpirationInDays:
36+
Type: Number
37+
Default: 14
38+
Description: The number of days log events are kept in CloudWatch Logs.
39+
2240
Conditions:
2341
IsProd: !Equals [!Ref Environment, PROD]
2442

43+
ShouldAllowSignUpEmailDomain:
44+
!Not [!Equals [!Ref AllowedSignUpEmailDomain, ""]]
45+
2546
Resources:
2647

2748
# Custom resource to transform input to lowercase.
@@ -68,7 +89,10 @@ Resources:
6889
Type: "AWS::Cognito::UserPool"
6990
Properties:
7091
AdminCreateUserConfig:
71-
AllowAdminCreateUserOnly: true
92+
AllowAdminCreateUserOnly: !If
93+
- ShouldAllowSignUpEmailDomain
94+
- false
95+
- true
7296
InviteMessageTemplate:
7397
EmailMessage:
7498
!Sub >
@@ -86,6 +110,11 @@ Resources:
86110
- email
87111
AutoVerifiedAttributes:
88112
- email
113+
LambdaConfig: !If
114+
- ShouldAllowSignUpEmailDomain
115+
- PreAuthentication: !GetAtt CognitoUserPoolEmailDomainVerifyFunction.Arn
116+
PreSignUp: !GetAtt CognitoUserPoolEmailDomainVerifyFunction.Arn
117+
- !Ref AWS::NoValue
89118
Schema:
90119
- Required: true
91120
Name: email
@@ -137,6 +166,67 @@ Resources:
137166
UserPoolId:
138167
!Ref PCAUserPool
139168

169+
CognitoUserPoolEmailDomainVerifyFunction:
170+
Type: AWS::Serverless::Function
171+
Condition: ShouldAllowSignUpEmailDomain
172+
Properties:
173+
Handler: index.handler
174+
Runtime: nodejs18.x
175+
Timeout: 3
176+
Environment:
177+
Variables:
178+
ALLOWED_SIGNUP_EMAIL_DOMAINS: !Ref AllowedSignUpEmailDomain
179+
InlineCode: |
180+
exports.handler = async (event, context) => {
181+
console.log(event);
182+
const allowed_domains = (
183+
process.env?.ALLOWED_SIGNUP_EMAIL_DOMAINS
184+
.split(",").map(domain => {return domain.trim()})
185+
);
186+
const { email } = event.request?.userAttributes;
187+
if (!email || !email.includes('@')) {
188+
throw Error('Username does not exists or invalid email address');
189+
}
190+
const emailDomain = email?.split('@')[1];
191+
if (!emailDomain || !allowed_domains) {
192+
throw new Error('Server error - invalid configuration');
193+
}
194+
if (!allowed_domains.includes(emailDomain) && allowed_domains != "*") {
195+
throw new Error('Invalid email address domain');
196+
}
197+
return event;
198+
};
199+
LoggingConfig:
200+
LogGroup:
201+
Fn::Sub: /${AWS::StackName}/lambda/CognitoUserPoolEmailDomainVerifyFunction
202+
Metadata:
203+
cfn_nag:
204+
rules_to_suppress:
205+
- id: W89
206+
reason: Customer can use VPC if desired
207+
- id: W92
208+
reason: Customer can choose reserved concurrency based on their requirement.
209+
DependsOn:
210+
- CognitoUserPoolEmailDomainVerifyFunctionLogGroup
211+
212+
CognitoUserPoolEmailDomainVerifyFunctionLogGroup:
213+
Type: AWS::Logs::LogGroup
214+
Properties:
215+
LogGroupName:
216+
Fn::Sub: /${AWS::StackName}/lambda/CognitoUserPoolEmailDomainVerifyFunction
217+
RetentionInDays:
218+
Ref: CloudWatchLogsExpirationInDays
219+
220+
CognitoUserPoolEmailDomainVerifyPermission:
221+
Type: AWS::Lambda::Permission
222+
Condition: ShouldAllowSignUpEmailDomain
223+
Properties:
224+
Action: lambda:InvokeFunction
225+
FunctionName: !Ref CognitoUserPoolEmailDomainVerifyFunction
226+
Principal: cognito-idp.amazonaws.com
227+
SourceAccount: !Ref AWS::AccountId
228+
SourceArn: !GetAtt PCAUserPool.Arn
229+
140230
Outputs:
141231
AdminUser:
142232
Value: !Ref AdminUser

pca-ui/cfn/pca-ui.template

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ Parameters:
1616
AllowedPattern: ".+\\@.+\\..+"
1717
ConstraintDescription: Must be valid email address eg. [email protected]
1818

19+
AllowedSignUpEmailDomain:
20+
Type: String
21+
Default: ""
22+
Description: >-
23+
Email address domain (example.com) or comma separated list of email domains (example1.com,
24+
example2.com) allowed to signin and signup using the web UI. To allow signup from any domain,
25+
enter *.
26+
If left empty, signup via the web UI is disabled and users will have to be created
27+
using
28+
Cognito.
29+
AllowedPattern: '^(\*||([\w-]+\.)+[\w-]{2,6}(, *([\w-]+\.)+[\w-]{2,6})*)$'
30+
1931
AudioBucket:
2032
Type: String
2133
Default: InputBucketName
@@ -128,6 +140,7 @@ Resources:
128140
Parameters:
129141
AdminUsername: !Ref AdminUsername
130142
AdminEmail: !Ref AdminEmail
143+
AllowedSignUpEmailDomain: !Ref AllowedSignUpEmailDomain
131144
WebUri: !GetAtt Web.Outputs.Uri
132145
Environment: !Ref Environment
133146
Name:

0 commit comments

Comments
 (0)