This is a simple AWS Lambda function that demonstrates how to use Fixie to make HTTP requests from static IP addresses. The function makes requests to httpbin.org through Fixie's proxy to show the static IP address in action.
Note: While this example uses AWS SAM for automated deployments and local testing, the Lambda handler code in src/index.js is framework-agnostic. You can use it with other deployment frameworks like Serverless Framework, Terraform, CDK, or even paste it directly into the AWS Lambda console UI.
-
AWS SAM CLI - For local testing
# Install via Homebrew (macOS) brew install aws-sam-cli # Or via pip pip install aws-sam-cli
-
Node.js - Version 18.x or later
node --version # Should be v18.x or later -
Fixie Account - Sign up at app.usefixie.com/signup
cd ~/Code/aws-lambda-example
cd src
npm install
cd ..Edit env.json and replace the placeholder with your actual Fixie URL:
{
"IpCheckFunction": {
"FIXIE_URL": "http://fixie:your-actual-token@your-actual-subdomain.usefixie.com:80"
}
}To get your Fixie URL:
- Go to app.usefixie.com
- Create a new proxy (if you haven't already)
- Copy your
FIXIE_URLfrom the dashboard - Paste it into
env.json
Option 1: Invoke the function directly
sam local invoke IpCheckFunction --env-vars env.jsonThis will output the Lambda function's response showing your static IP address from httpbin.org.
Option 2: Start a local API Gateway
sam local start-api --env-vars env.jsonThen in another terminal, make requests to check your static IP:
curl http://localhost:3000/ip
{
"message": "Request successful via Fixie static IP",
"static_ip": "YOUR_FIXIE_IP",
"proxied_through": "Fixie",
"note": "The IP address shown is your Fixie static IP",
"full_response": {
"origin": "YOUR_FIXIE_IP"
}
}%Check the terminal window where sam local start-api is running. You'll see logs showing the Lambda function is using Fixie:
Invoking src/index.handler (nodejs18.x)
Lambda function invoked
Using Fixie proxy: your-subdomain.usefixie.com:80
Making request to: https://httpbin.org/ip
Request successful
And response for curl http://localhost:3000/ip will include one of your Fixie's static IPs
You can also check your Fixie dashboard at app.usefixie.com to see the request logs and see the traffic going through your static IPs.
- Reads FIXIE_URL from environment variables
- Parses the proxy credentials (username, password, host, port)
- Makes an HTTPS request to httpbin.org/ip through the Fixie proxy
- Returns the static IP address that httpbin.org sees (which is Fixie's static IP!)
Make sure you've:
- Created a Fixie account and proxy
- Updated
env.jsonwith your actual Fixie URL - Passed the
--env-vars env.jsonflag when runningsam local invokeorsam local start-api
Check that:
- Your Fixie URL is correct (including the token)
- You have an active internet connection
- Your Fixie account is active and not over quota
Install AWS SAM CLI:
brew install aws-sam-cliTo deploy this function to AWS Lambda:
# Build the function
sam build
# Deploy (first time)
sam deploy --guided
# Subsequent deploys
sam deployDuring deployment, you'll be prompted to provide your FIXIE_URL as a parameter.
- Email: team@usefixie.com
- Documentation: usefixie.com/documentation