Skip to content

aws-samples/amazon-location-service-serverless-address-enrichment

Serverless Address Enrichment with Amazon Location Service

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.

Highlevel Architecture

Screen Shot 2021-12-09 at 12 08 50 PM

  1. The Scatter Lambda function takes a data set from the S3 bucket labeled input and breaks it into equal sized shards.
  2. 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
  3. The Gather Lambda function takes each shard from the post-processed bucket and appends them into a complete dataset with additional address information.

Deploying the Project

Prerequistes:

To use the SAM CLI, you need the following tools:

This Sample Includes:

  • 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

Deploy the Sam-App:

  1. 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.
  2. Use cd ~/amazon-location-service-serverless-address-validationto change into the project directory containing the template.yaml file SAM uses to build your application.
  3. Use sam build to build your application using SAM. You should see:

Screen Shot 2021-12-13 at 3 02 51 PM

  1. 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.

Screen Shot 2021-12-13 at 3 15 11 PM

Testing the Application

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

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages