Skip to content

Commit 0157412

Browse files
committed
CF template: update CF template for release v1.4
1 parent 4221be6 commit 0157412

File tree

1 file changed

+31
-17
lines changed

1 file changed

+31
-17
lines changed

geocore-semantic-search-with-opensearch.yml

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,9 @@ Parameters:
4545
NoEcho: 'true'
4646
Type: String
4747
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
5348
OSSecretID:
5449
Type: String
55-
Default: !Sub '${Environment}/OpenSearch/SemanticSearch'
50+
Default: /webpresence/search/opensearch-secret
5651
Description: SSM parameter name for OpenSearch user name and password
5752

5853

@@ -80,8 +75,8 @@ Resources:
8075
EngineVersion: 'OpenSearch_2.11'
8176
DomainName: semantic-search
8277
ClusterConfig:
83-
#InstanceType: "r6g.2xlarge.search"
84-
InstanceType: "t3.medium.search"
78+
InstanceType: "m6g.large.search"
79+
#InstanceType: "t3.medium.search"
8580
EBSOptions:
8681
EBSEnabled: True
8782
VolumeSize: 20
@@ -123,7 +118,7 @@ Resources:
123118
Type: AWS::SageMaker::NotebookInstance
124119
Properties:
125120
NotebookInstanceName: semantic-search-nb
126-
InstanceType: ml.t3.medium
121+
InstanceType: ml.t3.2xlarge
127122
RoleArn: !GetAtt NBRole.Arn
128123
DefaultCodeRepository: !GetAtt CodeRepository.CodeRepositoryName
129124

@@ -207,12 +202,12 @@ Resources:
207202
# Lambda Function: invoke sagemaker model endpoints
208203
# and perfrom KNN search in the OpenSearch domain
209204
########################################################
210-
InvokeSagemakerEndpointPretrain:
205+
LambdaSearch:
211206
Type: AWS::Serverless::Function
212207
Properties:
213208
CodeUri:
214209
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
216211

217212
MemorySize: 512
218213
Timeout: 900
@@ -225,11 +220,11 @@ Resources:
225220
Environment:
226221
Variables:
227222
MY_AWS_REGION: ca-central-1
228-
OS_ENDPOINT: !Ref OSEndpoint
223+
OS_ENDPOINT: !ImportValue OpenSearchEndpoint
229224
OS_SECRET_ID: !Ref OSSecretID
230225
SAGEMAKER_ENDPOINT: !Ref SagemakerEndpoint
231226
PackageType: Zip
232-
Role: !GetAtt InvokeSagemakerLambdaExecutionRole.Arn
227+
Role: !GetAtt LambdaSearchExecutionRole.Arn
233228
Events:
234229
ApiEvent:
235230
Type: Api
@@ -238,7 +233,7 @@ Resources:
238233
Path: /*
239234
Method: any
240235

241-
InvokeSagemakerLambdaExecutionRole:
236+
LambdaSearchExecutionRole:
242237
Type: AWS::IAM::Role
243238
Properties:
244239
AssumeRolePolicyDocument:
@@ -249,7 +244,7 @@ Resources:
249244
Service: lambda.amazonaws.com
250245
Action: sts:AssumeRole
251246
Policies:
252-
- PolicyName: InvokeSagemakerLambdaExecutionPolicy
247+
- PolicyName: LambdaSearchExecutionPolicy
253248
PolicyDocument:
254249
Version: "2012-10-17"
255250
Statement:
@@ -429,7 +424,7 @@ Resources:
429424
x-amazon-apigateway-integration: #Integration response:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-api-gateway-extensions.html
430425
type: aws_proxy
431426
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'
433428
responses:
434429
default:
435430
statusCode: "200"
@@ -484,7 +479,25 @@ Resources:
484479
gatewayresponse.header.Access-Control-Allow-Methods: "'GET,OPTIONS'"
485480
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
486481
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
488501

489502

490503
LogGroup:
@@ -493,3 +506,4 @@ Resources:
493506
ServiceToken: !ImportValue LogGroupHelperLambdaArn
494507
LogGroupName: !Sub '/${Environment}/webpresence/search'
495508
RetentionInDays: 3653
509+

0 commit comments

Comments
 (0)