This is an API implemented with serverless technologies and it serves the frontend of Melbourne City On-street Parking Finder. It consists of two components:
- An AWS Lambda function that handles queries from UI.
- A workflow for ingesting On-street parking sensor data from City of Melbourne Open Data Platform, orchestrated with AWS Step Functions and Lambda functions.
- Install AWS SAM Local
- Use virtualenv.
mkvirtualenv find-parking
, orworkon find-parking
if the virtualenvfind-parking
already exists. - Install python dependencies.
pip install -r requirements.txt
- Start localstack.
npm run start_localstack
- Seed local S3 bucket and SSM with test data.
npm run seed_data
- Watch and transpile individual Lambda function.
npm run watch_load_parking_sensor_data_from_s3
npm run watch_download_parking_sensor_data
npm run watch_download_parking_restrictions_data
npm run watch_parking_sensor_query_handler
- Run individual Lambda functions.
npm run run_load_parking_sensor_data_from_s3
npm run run_download_parking_sensor_data
npm run run_download_parking_restrictions_data
npm run run_parking_sensor_query_handler
- Run the API locally.
npm run run_parking_sensor_query_api
- Test the API locally.
Visithttp://127.0.0.1:3001/findAvailableParkings?lat=-37.8147527&lng=144.9647163&radiusInMeter=500
- Transpile all Typescript code in preparation for packaging.
npm run transpile
- Package the Lambda function.
sam package --template-file deploy/template.yaml --s3-bucket <bucket_name> --s3-prefix find-parking/artefacts --output-template-file tmp/find_parking_cfn.yaml
- Deploy stack with CloudFormation.
aws cloudformation deploy --template-file /Users/samli/dev/find-parking/tmp/find_parking_cfn.yaml --stack-name <stack_name> --capabilities CAPABILITY_IAM --parameter-overrides dataBucket=<bucket_name> downloadDestPrefix=find-parking/data