Skip to content

Commit 9d0b91f

Browse files
committed
Update geolocator stack to add nts grid lambda and api
1 parent 08cfa0b commit 9d0b91f

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

docs/cloudformation/geolocator-web-presence.yml

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Parameters:
3333
Conditions:
3434
IsProd: !Equals [prod, !Ref Environment]
3535

36-
Resources:
36+
Resources:
3737
Geolocator:
3838
Type: AWS::Serverless::Function
3939
Properties:
@@ -81,6 +81,34 @@ Resources:
8181
Path: /*
8282
Method: any
8383

84+
NTSTwoFiftyKLambda:
85+
Type: AWS::Serverless::Function
86+
Properties:
87+
Runtime: python3.13
88+
Role: !GetAtt LambdaExecutionRole.Arn
89+
CodeUri:
90+
Bucket: !Ref DeploymentBucket
91+
Key: cloudformation-templates/lambda/geolocator/nts-250k-20250725-1200.zip
92+
MemorySize: 3009
93+
Handler: app.lambda_handler
94+
Timeout: 30
95+
Environment:
96+
Variables:
97+
INDEX_NAME: nts-index
98+
MY_AWS_REGION: ca-central-1
99+
OS_ENDPOINT: !Ref OSEndpoint
100+
OS_SECRET_ID: !Ref OSSecretID
101+
Events:
102+
ApiEvent:
103+
Type: Api
104+
Properties:
105+
RestApiId: !Ref RestApi
106+
Path: /*
107+
Method: any
108+
Layers:
109+
- arn:aws:lambda:ca-central-1:759472643633:layer:opensearchpy-layer:2
110+
- arn:aws:lambda:ca-central-1:336392948345:layer:AWSSDKPandas-Python313:3
111+
84112
LambdaExecutionRole:
85113
Type: AWS::IAM::Role
86114
Properties:
@@ -326,6 +354,38 @@ Resources:
326354
"user_agent": "$context.identity.userAgent",
327355
"http_method": "$context.httpMethod"
328356
}
357+
/nts-250k:
358+
get:
359+
consumes:
360+
- "application/json"
361+
produces:
362+
- "application/json"
363+
responses: #Method response:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-method-methodresponse.html
364+
"200":
365+
description: "200 response"
366+
# schema:
367+
# $ref: "#/definitions/Empty"
368+
headers:
369+
Access-Control-Allow-Origin:
370+
type: "string"
371+
x-amazon-apigateway-integration: #Integration response:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-api-gateway-extensions.html
372+
type: aws
373+
httpMethod: POST
374+
uri: !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${NTSTwoFiftyKLambda.Arn}/invocations'
375+
responses:
376+
default:
377+
statusCode: "200"
378+
responseParameters:
379+
method.response.header.Access-Control-Allow-Origin: "'*'"
380+
requestTemplates:
381+
application/json: |
382+
{
383+
"q": "$input.params('q')",
384+
"ip_address": "$context.identity.sourceIp",
385+
"timestamp": "$context.requestTimeEpoch",
386+
"user_agent": "$context.identity.userAgent",
387+
"http_method": "$context.httpMethod"
388+
}
329389
geolocatorS3Bucket:
330390
Type: AWS::S3::Bucket
331391
Properties:
1.78 KB
Binary file not shown.

0 commit comments

Comments
 (0)