/aws-lambda-static-ip

Example SAM template of how to create a lambda that sends traffic via a static IP

Primary LanguageJavaScriptMIT LicenseMIT

Twitter GitHub LinkedIn Ready, Set, Cloud!

Static IP Address from a Lambda Function

This repo is inteneded to provide an example SAM template of how to create a lambda function that sends outbound web traffic via a static IP

Use Case

There are many use cases for why you would need a static IP for web traffic. The primary use case driving this design was for whitelisting IPs for integrations. Whether it's a website or a partner company, whitelisting IPs is a strong way to provide security for an integrator.

Deployment

This repo is configured to deploy into your AWS account out of the box in an effort to provide you with the quickest solution possible. Here is the deployment checklist:

  1. Install and configure the AWS CLI and SAM CLI on your machine.
  2. Update the root package.json to replace the REPLACE_WITH_BUCKET_NAME variables with an S3 bucket in your account
  3. In a terminal window, run the npm run deploy command

Outputs

The template will output two values:

  • TestEndpoint - This is a public GET endpoint that will verify the lambda is executing outbound traffic with the created static IP address
  • StaticIpAddress - The IP address created in your account. This is the IP address that your traffic will route through.

Resources

The following resources will be automatically deployed into your AWS Account:

Architecture

To facilitate sending outbound web traffic through a static IP, the below architecture is built.

AWS Architecture diagram for a lambda with a static IP address

Support

If you like this repo and the accompanying blog post, show your support by following me on Twitter or connecting with me on LinkedIn. I'm always happy to answer any questions you might have and am open to any ideas you'd like to see turned into an article on my blog!