Repo for easy creating geoip API based on AWS lambda and Maxmind's GeoLite2 database.
Inspired by tmaiaroto/go-lambda-geoip.
- An AWS account (and configured credentials for CLI)
- golang
- Maxmind's GeoLite2 City/Country database.
- Serverless Framework
- go-bindata
Build image
docker build . -t izikaj/geoip --build-arg MAXMIND_LICENSE_KEY=$MAXMIND_LICENSE_KEY
Deploy it to AWS
docker run -e AWS_ACCESS_KEY_ID="XXXXXXXXX" -e AWS_SECRET_ACCESS_KEY="YYYYYYYYYYYYY" -it izikaj/geoip
To run shell on image:
docker run -e AWS_ACCESS_KEY_ID="XXXXXXXXX" -e AWS_SECRET_ACCESS_KEY="YYYYYYYYYYYYY" -it izikaj/geoip sh
go install github.com/jteeuwen/go-bindata/go-bindata
Assuming you have AWS credentials configured and you've got the serverless
and go-bindata
ready to use.
You can run the following to retrieve the geoip data set, build, and deploy:
Download fresh Maxmind's database:
make download
To receive access to download the GeoLite2 databases, it now requires registration and license key usage.
Deploy stack:
make deploy
It should build and deploy the Lambda. It may take a little bit due to the size of the database file.
- build & deploy via docker
geocoder
function should work with geocoder-izi-lookup propely
- write tests
- return errors more detailed errors
- refactor code
arch -x86_64 zsh