Skip to content

Serverless usage of the maxminddb for geoip location

Notifications You must be signed in to change notification settings

ymwjbxxq/rust_geoip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless Geo Location

MaxMind provides IP intelligence through the GeoIP brand. Over 5,000 companies use GeoIP data to locate their Internet visitors, show them relevant content and ads, perform analytics, enforce digital rights, and efficiently route Internet traffic. GeoIP2 IP intelligence products and services can provide data on geolocation, network information, anonymizer status and offer three types of data

  • Binary Database
  • CSV Database
  • WebService

This repository is how to use the Binary Database in a serverless context using the crates maxminddb

Requirements

Documentation

Deployment Instructions

The SAM template deploys an Amazon API Gateway HTTP API and an AWS Lambda function.

  1. Create a new directory, navigate to that directory in a terminal and clone the GitHub repository:

    git clone https://github.com/ymwjbxxq/rust_geoip
    
  2. Change directory to the pattern directory:

    cd rust_geoip
    
  3. Install dependencies and build:

    make build
    
  4. From the command line, use AWS SAM to deploy the AWS resources for the pattern as specified in the template.yml file:

    make deploy
    
  5. During the prompts:

    • Enter a stack name
    • Enter the desired AWS Region
    • Allow SAM CLI to create IAM roles with the required permissions.

    Once you have run sam deploy -guided mode once and saved arguments to a configuration file (samconfig.toml), you can use sam deploy in future to use these defaults.

  6. Note the outputs from the SAM deployment process. These contain the resource names and ARNs which are used for testing.

Testing

Binary files are not provided

Once the application is deployed, retrieve the HttpApiEndpoint value from CloudFormation Outputs. Then, either browse to the endpoint in a web browser or call the endpoint from Postman.

Example GET Request: https://{HttpApiId}.execute-api.{region}.amazonaws.com/countrycode

Response:

{
  "countrycode": "IT"
}

Cleanup

  1. Delete the stack
    make delete

About

Serverless usage of the maxminddb for geoip location

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published