@@ -45,14 +45,9 @@ Parameters:
45
45
NoEcho : ' true'
46
46
Type : String
47
47
Default : Semantic123!
48
- # Todo: change OSEndpoint to a resource that can be referenced
49
- OSEndpoint :
50
- Type : String
51
- Default : search-semantic-search-dfcizxxxuj62dusl5skmeu3czu.ca-central-1.es.amazonaws.com
52
- Description : OpenSearch endpoint
53
48
OSSecretID :
54
49
Type : String
55
- Default : !Sub '${Environment}/OpenSearch/SemanticSearch'
50
+ Default : /webpresence/search/opensearch-secret
56
51
Description : SSM parameter name for OpenSearch user name and password
57
52
58
53
@@ -80,8 +75,8 @@ Resources:
80
75
EngineVersion : ' OpenSearch_2.11'
81
76
DomainName : semantic-search
82
77
ClusterConfig :
83
- # InstanceType: "r6g.2xlarge .search"
84
- InstanceType : " t3.medium.search"
78
+ InstanceType : " m6g.large .search"
79
+ # InstanceType: "t3.medium.search"
85
80
EBSOptions :
86
81
EBSEnabled : True
87
82
VolumeSize : 20
@@ -123,7 +118,7 @@ Resources:
123
118
Type : AWS::SageMaker::NotebookInstance
124
119
Properties :
125
120
NotebookInstanceName : semantic-search-nb
126
- InstanceType : ml.t3.medium
121
+ InstanceType : ml.t3.2xlarge
127
122
RoleArn : !GetAtt NBRole.Arn
128
123
DefaultCodeRepository : !GetAtt CodeRepository.CodeRepositoryName
129
124
@@ -207,12 +202,12 @@ Resources:
207
202
# Lambda Function: invoke sagemaker model endpoints
208
203
# and perfrom KNN search in the OpenSearch domain
209
204
# #######################################################
210
- InvokeSagemakerEndpointPretrain :
205
+ LambdaSearch :
211
206
Type : AWS::Serverless::Function
212
207
Properties :
213
208
CodeUri :
214
209
Bucket : !Ref DeploymentBucket
215
- Key : cloudformation-templates/lambda/semantic-search/Invoke-sagemaker-pretrain-20240508-2200 .zip
210
+ Key : cloudformation-templates/lambda/semantic-search/LambdaSearch-2024062701430 .zip
216
211
217
212
MemorySize : 512
218
213
Timeout : 900
@@ -225,11 +220,11 @@ Resources:
225
220
Environment :
226
221
Variables :
227
222
MY_AWS_REGION : ca-central-1
228
- OS_ENDPOINT : !Ref OSEndpoint
223
+ OS_ENDPOINT : !ImportValue OpenSearchEndpoint
229
224
OS_SECRET_ID : !Ref OSSecretID
230
225
SAGEMAKER_ENDPOINT : !Ref SagemakerEndpoint
231
226
PackageType : Zip
232
- Role : !GetAtt InvokeSagemakerLambdaExecutionRole .Arn
227
+ Role : !GetAtt LambdaSearchExecutionRole .Arn
233
228
Events :
234
229
ApiEvent :
235
230
Type : Api
@@ -238,7 +233,7 @@ Resources:
238
233
Path : /*
239
234
Method : any
240
235
241
- InvokeSagemakerLambdaExecutionRole :
236
+ LambdaSearchExecutionRole :
242
237
Type : AWS::IAM::Role
243
238
Properties :
244
239
AssumeRolePolicyDocument :
@@ -249,7 +244,7 @@ Resources:
249
244
Service : lambda.amazonaws.com
250
245
Action : sts:AssumeRole
251
246
Policies :
252
- - PolicyName : InvokeSagemakerLambdaExecutionPolicy
247
+ - PolicyName : LambdaSearchExecutionPolicy
253
248
PolicyDocument :
254
249
Version : " 2012-10-17"
255
250
Statement :
@@ -429,7 +424,7 @@ Resources:
429
424
x-amazon-apigateway-integration : # Integration response:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-api-gateway-extensions.html
430
425
type : aws_proxy
431
426
httpMethod : POST
432
- uri : !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${InvokeSagemakerEndpointPretrain .Arn}/invocations'
427
+ uri : !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaSearch .Arn}/invocations'
433
428
responses :
434
429
default :
435
430
statusCode : " 200"
@@ -484,7 +479,25 @@ Resources:
484
479
gatewayresponse.header.Access-Control-Allow-Methods : " 'GET,OPTIONS'"
485
480
gatewayresponse.header.Access-Control-Allow-Origin : " '*'"
486
481
gatewayresponse.header.Access-Control-Allow-Headers : " 'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
487
-
482
+
483
+ Outputs :
484
+ OpenSearchEndpoint :
485
+ Description : OpenSearch domain endpoint
486
+ Value : !GetAtt OpenSearchDomain.DomainEndpoint
487
+ Export :
488
+ Name : OpenSearchEndpoint
489
+
490
+ OpenSearchDomainName :
491
+ Description : OpenSearch domain name
492
+ Value : !Ref OpenSearchServiceDomain
493
+
494
+ Region :
495
+ Description : Deployed Region
496
+ Value : !Ref AWS::Region
497
+
498
+ OpenSearchSecret :
499
+ Description : Name of the OpenSearch secret in Secrets Manager
500
+ Value : !Ref OpenSearchSecret
488
501
489
502
490
503
LogGroup :
@@ -493,3 +506,4 @@ Resources:
493
506
ServiceToken : !ImportValue LogGroupHelperLambdaArn
494
507
LogGroupName : !Sub '/${Environment}/webpresence/search'
495
508
RetentionInDays : 3653
509
+
0 commit comments