this is basically a reimplementation of dan-v/awslambdaproxy for my own understanding and trimmed down heavily to suit my own simpler use case
lambdaproxy is a short-lived anonymous HTTP proxy which draws IP addresses from the large pool of AWS-managed Lambda compute instances, with the goal of obfuscating network traffic
lambdaproxy utilizes the fact that AWS Lambda provides no guarantee as to which of AWS's large fleet of compute instances is assigned to any given (cold start) invocation. Thus, a Lambda function which simply serves an HTTP proxy will provide a different IP address each time it is invoked. Since it is not possible to connect to running Lambda functions directly, the Lambda function also establishes a reverse SSH tunnel to the proxy host, after which all HTTP traffic is forwarded from the proxy host to the Lambda function's HTTP proxy.
lambdaproxy
must be run on a publicly acessible host (eg. AWS EC2, AWS Lightsail)
- Install required:
go
(>=1.16)serverless
aws
- configure AWS credentials with
aws configure
git clone https://github.com/jaswon/lambdaproxy
cd lambdaproxy
make
- start the proxy with
bin/start
- use the proxy by forwarding a local port to
127.0.0.1:6789
on the server via SSH
- Each session lasts at most 15 minutes (the maximum execution duration of Lambda functions), but you can just rerun
bin/start
- AWS keeps Lambda instances alive for approximately 5-7 minutes after idling, which means that you'll receive the same IP address if you start the proxy less than 5-7 minutes after stopping