A serverless service that converts IP addresses into random GPS coordinates (always on land). Implemented with AWS Lambda and API Gateway.
- Authentication via API key
- Random coordinates always on land (continents)
- Serverless (AWS Lambda + API Gateway)
- Infrastructure as Code (Terraform)
- AWS CLI configured with credentials
- Terraform installed
- Python 3.9 or higher
- Clone the repository:
git clone https://github.com/your-username/ip-to-coords-api.git
cd ip-to-coords-api
- (Optional) Modify variables in
terraform/variables.tf
:
aws_region
: AWS Region
- Initialize and apply Terraform configuration:
cd terraform
terraform init
terraform plan
terraform apply
- After completion, get your API credentials:
terraform output -raw api_key # Get your API key
terraform output -raw api_endpoint # Get your API endpoint
terraform output -raw curl_example # Get a ready-to-use curl command
The API accepts GET requests with the following parameters:
ip
: The IP address to convertapi_key
: API key for authentication
You can get a ready-to-use curl command with:
terraform output -raw curl_example
Or make your own request:
curl "https://[your-api-id].execute-api.[region].amazonaws.com/coords?ip=1.2.3.4&api_key=[your-api-key]"
{
"ip": "1.2.3.4",
"latitude": 45.123456,
"longitude": -75.987654
}
.
├── src/
│ └── lambda_function.py # Lambda function code
├── terraform/
│ ├── main.tf # Main Terraform configuration
│ ├── variables.tf # Terraform variables
│ └── outputs.tf # Terraform outputs
├── .gitignore
├── LICENSE.md
└── README.md
This project is under the MIT License - see the LICENSE.md file for details.