mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Merge pull request #409 from Hestia-Homes/remote-assessment-api
updated serverless file to give fastapi access to sqs
This commit is contained in:
commit
91b911487a
2 changed files with 47 additions and 26 deletions
|
|
@ -125,7 +125,7 @@ def app():
|
|||
master_to_asset_list_filepath = None
|
||||
phase = False
|
||||
ecosurv_landlords = "paul butler|bromford"
|
||||
|
||||
|
||||
# Torus
|
||||
data_folder = "/Users/khalimconn-kowlessar/Documents/hestia/Customers/Torus/Phase 1"
|
||||
data_filename = "Torus Property Asset List - Phase 1.xlsx"
|
||||
|
|
|
|||
|
|
@ -50,34 +50,11 @@ functions:
|
|||
handler: backend.app.main.handler
|
||||
timeout: 30
|
||||
memorySize: 512
|
||||
role: FastApiLambdaRole
|
||||
events:
|
||||
- http:
|
||||
path: /{proxy+}
|
||||
method: ANY
|
||||
iamRoleStatements:
|
||||
- Effect: Allow
|
||||
Action:
|
||||
- sqs:SendMessage
|
||||
Resource:
|
||||
- Fn::GetAtt: [ EngineQueue, Arn ]
|
||||
- Effect: Allow
|
||||
Action:
|
||||
- s3:GetObject
|
||||
- s3:ListBucket
|
||||
Resource:
|
||||
- arn:aws:s3:::${env:PLAN_TRIGGER_BUCKET}
|
||||
- arn:aws:s3:::${env:PLAN_TRIGGER_BUCKET}/*
|
||||
- Effect: Allow
|
||||
Action:
|
||||
- s3:GetObject
|
||||
Resource:
|
||||
- arn:aws:s3:::${env:DATA_BUCKET}/*
|
||||
- arn:aws:s3:::${env:ENERGY_ASSESSMENTS_BUCKET}/*
|
||||
- arn:aws:s3:::${env:SAP_PREDICTIONS_BUCKET}/*
|
||||
- arn:aws:s3:::${env:CARBON_PREDICTIONS_BUCKET}/*
|
||||
- arn:aws:s3:::${env:HEAT_PREDICTIONS_BUCKET}/*
|
||||
- arn:aws:s3:::${env:HEATING_KWH_PREDICTIONS_BUCKET}/*
|
||||
- arn:aws:s3:::${env:HOTWATER_KWH_PREDICTIONS_BUCKET}/*
|
||||
|
||||
model-engine-lambda:
|
||||
image:
|
||||
|
|
@ -130,4 +107,48 @@ resources:
|
|||
Type: AWS::SQS::Queue
|
||||
Properties:
|
||||
QueueName: model-engine-queue
|
||||
VisibilityTimeout: 910 # must be >= lambda timeout (900)
|
||||
VisibilityTimeout: 910 # must be >= lambda timeout (900)
|
||||
|
||||
FastApiLambdaRole:
|
||||
Type: AWS::IAM::Role
|
||||
Properties:
|
||||
RoleName: retrofit-fastapi-lambda-role-${self:provider.region}
|
||||
AssumeRolePolicyDocument:
|
||||
Version: '2012-10-17'
|
||||
Statement:
|
||||
- Effect: Allow
|
||||
Principal:
|
||||
Service:
|
||||
- lambda.amazonaws.com
|
||||
Action:
|
||||
- sts:AssumeRole
|
||||
Policies:
|
||||
- PolicyName: FastApiLambdaPolicy
|
||||
PolicyDocument:
|
||||
Version: '2012-10-17'
|
||||
Statement:
|
||||
- Effect: Allow
|
||||
Action:
|
||||
- logs:CreateLogGroup
|
||||
- logs:CreateLogStream
|
||||
- logs:PutLogEvents
|
||||
Resource: arn:aws:logs:*:*:*
|
||||
- Effect: Allow
|
||||
Action:
|
||||
- sqs:SendMessage
|
||||
Resource:
|
||||
- Fn::GetAtt: [ EngineQueue, Arn ]
|
||||
- Effect: Allow
|
||||
Action:
|
||||
- s3:GetObject
|
||||
- s3:ListBucket
|
||||
Resource:
|
||||
- arn:aws:s3:::${env:PLAN_TRIGGER_BUCKET}
|
||||
- arn:aws:s3:::${env:PLAN_TRIGGER_BUCKET}/*
|
||||
- arn:aws:s3:::${env:DATA_BUCKET}/*
|
||||
- arn:aws:s3:::${env:ENERGY_ASSESSMENTS_BUCKET}/*
|
||||
- arn:aws:s3:::${env:SAP_PREDICTIONS_BUCKET}/*
|
||||
- arn:aws:s3:::${env:CARBON_PREDICTIONS_BUCKET}/*
|
||||
- arn:aws:s3:::${env:HEAT_PREDICTIONS_BUCKET}/*
|
||||
- arn:aws:s3:::${env:HEATING_KWH_PREDICTIONS_BUCKET}/*
|
||||
- arn:aws:s3:::${env:HOTWATER_KWH_PREDICTIONS_BUCKET}/*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue