This repository accompanies a post from the AWS Compute Compute Blog Enriching addresses with AWS Lambda and the Amazon Location Service. The repository contains a SAM tempalte for deploying a Serverless Address Enrichment pipeline using Amazon S3, AWS Lambda, and Amazon Location Service.
- The Scatter Lambda function takes a data set from the S3 bucket labeled input and breaks it into equal sized shards.
- The Process Lambda function takes each shard from the pre-processed bucket and performs Address Enrichment in parallel calling the Amazon Location Service Places API
- The Gather Lambda function takes each shard from the post-processed bucket and appends them into a complete dataset with additional address information.
To use the SAM CLI, you need the following tools:
- AWS account
- AWS SAM CLI - Install the SAM CLI
- Python 3.9 or later - download the latest of version of python
- An AWS Identity and Access Managment role with appropriate access
- template.yaml: Contains the AWS SAM template that defines you applications AWS resources, which includes a Place Index for Amazon Location Service
- scatterfunction/: Contains the Lambda handler logic behind the scatter function and its requirements
- 2waygeocoderfunction/: Contains the Lambda handler logic for the processor function which calls the Amazon Location Service Places API to perform address enrichment
- gatherfunction/: Contains the Lambda handler logic for the gather function which appends all of processed data into a complete dataset
- Use
git clone https://github.com/aws-samples/amazon-location-service-serverless-address-validation
to clone the repository to your environment where AWS SAM and python are installed. - Use
cd ~/amazon-location-service-serverless-address-validation
to change into the project directory containing the template.yaml file SAM uses to build your application. - Use
sam build
to build your application using SAM. You should see:
-
Use
sam deploy --guided
to deploy the application to your AWS account. Enter custom values for the application parameters.- NOTE: be sure to follow S3 naming conventions by providing globally unique names for your s3 buckets such as input-YOURNAME raw-YOUR-PHONE-NUMBER or destination-YOUR-AWS-ACCOUNT-ID. See below for an example.
Download the below samples locally, unzip the files, and upload the CSV to your input S3 bucket to trigger the adddress enrichment pipeline.
Geocoding: City of Hartford, CT Business Listing Dataset
Reverse Geocoding: Miami Housing Dataset
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.