@@ -106,7 +106,37 @@ Resources:
106106 Path : /*
107107 Method : any
108108 Layers :
109- - arn:aws:lambda:ca-central-1:759472643633:layer:opensearchpy-layer:2
109+ - !Sub " arn:aws:lambda:ca-central-1:${AWS::AccountId}:layer:opensearchpy-layer:3"
110+ - arn:aws:lambda:ca-central-1:336392948345:layer:AWSSDKPandas-Python313:3
111+
112+ NRCanGeoLocationLambda :
113+ Type : AWS::Serverless::Function
114+ Properties :
115+ Runtime : python3.13
116+ Role : !GetAtt LambdaExecutionRole.Arn
117+ CodeUri :
118+ Bucket : !Ref DeploymentBucket
119+ Key : cloudformation-templates/lambda/geolocator/nrcan-geolocation-api-20251208-1200.zip
120+ MemorySize : 3009
121+ Handler : lambda_function.lambda_handler
122+ Timeout : 30
123+ Environment :
124+ Variables :
125+ ADDRESS_RANGE_INDEX : geolocation-index-address-range
126+ ANALYTICS_TABLE_NAME : geolocation-analytics-table
127+ INDEX_NAME : geolocation-index
128+ MY_AWS_REGION : ca-central-1
129+ OS_ENDPOINT : !Ref OSEndpoint
130+ OS_SECRET_ID : !Ref OSSecretID
131+ Events :
132+ ApiEvent :
133+ Type : Api
134+ Properties :
135+ RestApiId : !Ref RestApi
136+ Path : /*
137+ Method : any
138+ Layers :
139+ - !Sub " arn:aws:lambda:ca-central-1:${AWS::AccountId}:layer:opensearchpy-layer:3"
110140 - arn:aws:lambda:ca-central-1:336392948345:layer:AWSSDKPandas-Python313:3
111141
112142 LambdaExecutionRole :
@@ -144,7 +174,7 @@ Resources:
144174 - Effect : Allow
145175 Action :
146176 - secretsmanager:GetSecretValue
147- Resource : !Sub "arn:aws:secretsmanager:ca-central-1:${AWS::AccountId}:secret:OpenSearchSecret-geocore-semantic-search-with-opensearch-stage *"
177+ Resource : !Sub "arn:aws:secretsmanager:ca-central-1:${AWS::AccountId}:secret:OpenSearchSecret-geocore-semantic-search-with-opensearch-${Environment} *"
148178 - Effect : Allow
149179 Action :
150180 - es:ESHttpGet
@@ -386,6 +416,217 @@ Resources:
386416 "user_agent": "$context.identity.userAgent",
387417 "http_method": "$context.httpMethod"
388418 }
419+ /geolocation/en/locate :
420+ get :
421+ consumes :
422+ - " application/json"
423+ produces :
424+ - " application/json"
425+ responses : # Method response:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-method-methodresponse.html
426+ " 200 " :
427+ description : " 200 response"
428+ # schema:
429+ # $ref: "#/definitions/Empty"
430+ headers :
431+ Access-Control-Allow-Origin :
432+ type : " string"
433+ x-amazon-apigateway-integration : # Integration response:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-api-gateway-extensions.html
434+ type : aws
435+ httpMethod : POST
436+ uri : !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${NRCanGeoLocationLambda.Arn}/invocations'
437+ responses :
438+ default :
439+ statusCode : " 200"
440+ responseParameters :
441+ method.response.header.Access-Control-Allow-Origin : " '*'"
442+ requestTemplates :
443+ application/json : |
444+ {
445+ "q": "$input.params('q')",
446+ "bbox": "$input.params('bbox')",
447+ "referrer": "$input.params('referrer')",
448+ "ip_address": "$context.identity.sourceIp",
449+ "timestamp": "$context.requestTimeEpoch",
450+ "user_agent": "$context.identity.userAgent",
451+ "http_method": "$context.httpMethod",
452+ "path": "$context.path"
453+ }
454+ /geolocation/en/autocomplete :
455+ get :
456+ consumes :
457+ - " application/json"
458+ produces :
459+ - " application/json"
460+ responses : # Method response:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-method-methodresponse.html
461+ " 200 " :
462+ description : " 200 response"
463+ # schema:
464+ # $ref: "#/definitions/Empty"
465+ headers :
466+ Access-Control-Allow-Origin :
467+ type : " string"
468+ x-amazon-apigateway-integration : # Integration response:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-api-gateway-extensions.html
469+ type : aws
470+ httpMethod : POST
471+ uri : !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${NRCanGeoLocationLambda.Arn}/invocations'
472+ responses :
473+ default :
474+ statusCode : " 200"
475+ responseParameters :
476+ method.response.header.Access-Control-Allow-Origin : " '*'"
477+ requestTemplates :
478+ application/json : |
479+ {
480+ "q": "$input.params('q')",
481+ "bbox": "$input.params('bbox')",
482+ "referrer": "$input.params('referrer')",
483+ "ip_address": "$context.identity.sourceIp",
484+ "timestamp": "$context.requestTimeEpoch",
485+ "user_agent": "$context.identity.userAgent",
486+ "http_method": "$context.httpMethod",
487+ "path": "$context.path"
488+ }
489+ /geolocation/en/suggest :
490+ get :
491+ consumes :
492+ - " application/json"
493+ produces :
494+ - " application/json"
495+ responses : # Method response:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-method-methodresponse.html
496+ " 200 " :
497+ description : " 200 response"
498+ # schema:
499+ # $ref: "#/definitions/Empty"
500+ headers :
501+ Access-Control-Allow-Origin :
502+ type : " string"
503+ x-amazon-apigateway-integration : # Integration response:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-api-gateway-extensions.html
504+ type : aws
505+ httpMethod : POST
506+ uri : !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${NRCanGeoLocationLambda.Arn}/invocations'
507+ responses :
508+ default :
509+ statusCode : " 200"
510+ responseParameters :
511+ method.response.header.Access-Control-Allow-Origin : " '*'"
512+ requestTemplates :
513+ application/json : |
514+ {
515+ "q": "$input.params('q')",
516+ "bbox": "$input.params('bbox')",
517+ "referrer": "$input.params('referrer')",
518+ "ip_address": "$context.identity.sourceIp",
519+ "timestamp": "$context.requestTimeEpoch",
520+ "user_agent": "$context.identity.userAgent",
521+ "http_method": "$context.httpMethod",
522+ "path": "$context.path"
523+ }
524+ /geolocation/fr/locate :
525+ get :
526+ consumes :
527+ - " application/json"
528+ produces :
529+ - " application/json"
530+ responses : # Method response:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-method-methodresponse.html
531+ " 200 " :
532+ description : " 200 response"
533+ # schema:
534+ # $ref: "#/definitions/Empty"
535+ headers :
536+ Access-Control-Allow-Origin :
537+ type : " string"
538+ x-amazon-apigateway-integration : # Integration response:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-api-gateway-extensions.html
539+ type : aws
540+ httpMethod : POST
541+ uri : !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${NRCanGeoLocationLambda.Arn}/invocations'
542+ responses :
543+ default :
544+ statusCode : " 200"
545+ responseParameters :
546+ method.response.header.Access-Control-Allow-Origin : " '*'"
547+ requestTemplates :
548+ application/json : |
549+ {
550+ "q": "$input.params('q')",
551+ "bbox": "$input.params('bbox')",
552+ "referrer": "$input.params('referrer')",
553+ "ip_address": "$context.identity.sourceIp",
554+ "timestamp": "$context.requestTimeEpoch",
555+ "user_agent": "$context.identity.userAgent",
556+ "http_method": "$context.httpMethod",
557+ "path": "$context.path"
558+ }
559+ /geolocation/fr/autocomplete :
560+ get :
561+ consumes :
562+ - " application/json"
563+ produces :
564+ - " application/json"
565+ responses : # Method response:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-method-methodresponse.html
566+ " 200 " :
567+ description : " 200 response"
568+ # schema:
569+ # $ref: "#/definitions/Empty"
570+ headers :
571+ Access-Control-Allow-Origin :
572+ type : " string"
573+ x-amazon-apigateway-integration : # Integration response:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-api-gateway-extensions.html
574+ type : aws
575+ httpMethod : POST
576+ uri : !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${NRCanGeoLocationLambda.Arn}/invocations'
577+ responses :
578+ default :
579+ statusCode : " 200"
580+ responseParameters :
581+ method.response.header.Access-Control-Allow-Origin : " '*'"
582+ requestTemplates :
583+ application/json : |
584+ {
585+ "q": "$input.params('q')",
586+ "bbox": "$input.params('bbox')",
587+ "referrer": "$input.params('referrer')",
588+ "ip_address": "$context.identity.sourceIp",
589+ "timestamp": "$context.requestTimeEpoch",
590+ "user_agent": "$context.identity.userAgent",
591+ "http_method": "$context.httpMethod",
592+ "path": "$context.path"
593+ }
594+ /geolocation/fr/suggest :
595+ get :
596+ consumes :
597+ - " application/json"
598+ produces :
599+ - " application/json"
600+ responses : # Method response:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-method-methodresponse.html
601+ " 200 " :
602+ description : " 200 response"
603+ # schema:
604+ # $ref: "#/definitions/Empty"
605+ headers :
606+ Access-Control-Allow-Origin :
607+ type : " string"
608+ x-amazon-apigateway-integration : # Integration response:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-api-gateway-extensions.html
609+ type : aws
610+ httpMethod : POST
611+ uri : !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${NRCanGeoLocationLambda.Arn}/invocations'
612+ responses :
613+ default :
614+ statusCode : " 200"
615+ responseParameters :
616+ method.response.header.Access-Control-Allow-Origin : " '*'"
617+ requestTemplates :
618+ application/json : |
619+ {
620+ "q": "$input.params('q')",
621+ "bbox": "$input.params('bbox')",
622+ "referrer": "$input.params('referrer')",
623+ "ip_address": "$context.identity.sourceIp",
624+ "timestamp": "$context.requestTimeEpoch",
625+ "user_agent": "$context.identity.userAgent",
626+ "http_method": "$context.httpMethod",
627+ "path": "$context.path"
628+ }
629+
389630 geolocatorS3Bucket :
390631 Type : AWS::S3::Bucket
391632 Properties :
0 commit comments