online-bridge-hackathon / DDS

An api that returns DDS results for a given deal or partial deal
https://bit.ly/bridge-hackathon
Apache License 2.0
4 stars 7 forks source link

files to deploy on AWS Lambda #93

Closed kiat-huang closed 4 years ago

kiat-huang commented 4 years ago

This is a full set of files to deploy on AWS Lambda cloud functions, with API, SSL cert, domain name via Route53. The API can be run locally with "python api.py" to test. Note to get this working on Lambdas I had to recompile libdds.so on an Amazon Linux docker image (I could not find a better way to do it) which entailed creating a build env on the image once running. If using the same libdds.so image uloaded there is no need to recompile - only if the libdds code changes. All documented in the README.md.

The Lambda is configured with 512MB RAM taking ~16 secs (!) and tested with 1792MB RAM improving to ~4 secs.

curl --header "Content-Type: application/json" --request POST --data '{"hands":{"S":["D3", "C6", "DT", "D8", "DJ", "D6", "CA", "C3", "S2", "C2", "C4", "S9", "S7"],"W":["DA", "S4", "HT", "C5", "D4", "D7", "S6", "S3", "DK", "CT", "D2", "SK","H8"],"N":["C7", "H6", "H7", "H9", "CJ", "SA", "S8", "SQ", "D5", "S5", "HK", "C8", "HA"],"E":["H2", "H5", "CQ", "D9", "H4", "ST", "HQ", "SJ", "HJ", "DQ", "H3", "C9", "CK"]}}' https://dds.aws.globalbridge.app/api/dds-table/

tameware commented 4 years ago

It would be nice to eliminate the code duplication we have between our python files. We can wait to do that, though, until we've decided on our hosting platform and whether we'll use a Lambda function or a dedicated server.