All Projects → ainestal → terraform-lambda-fixed-ip

ainestal / terraform-lambda-fixed-ip

Licence: other
Provide a fixed IP (ElasticIP) to your AWS Lambdas

Programming Languages

HCL
1544 projects

Projects that are alternatives of or similar to terraform-lambda-fixed-ip

theme-next-three
JavaScript 3D library for NexT.
Stars: ✭ 27 (+35%)
Mutual labels:  module
jenkinsfile-runner-lambda
Run Jenkinsfiles in AWS Lambda
Stars: ✭ 52 (+160%)
Mutual labels:  lambda
Tomcat-Webmin-Module
Apache Tomcat Plugin for Webmin
Stars: ✭ 19 (-5%)
Mutual labels:  module
lambda-example
Example REST service for a Lambda article I wrote
Stars: ✭ 23 (+15%)
Mutual labels:  lambda
twbs-helper-module
Laminas (formerly Zend Framework) module for easy integration of Twitter Bootstrap
Stars: ✭ 18 (-10%)
Mutual labels:  module
ngx-image-drawing
Angular module to draw on images
Stars: ✭ 42 (+110%)
Mutual labels:  module
lambda-runtime-pypy3.5
AWS Lambda Runtime for PyPy 3.5
Stars: ✭ 17 (-15%)
Mutual labels:  lambda
serverless-plugin-parcel
A Serverless framework plugin to bundle assets with Parcel (ES6/7 or Typescript)
Stars: ✭ 23 (+15%)
Mutual labels:  lambda
duckpy
A simple Python library for searching on DuckDuckGo.
Stars: ✭ 20 (+0%)
Mutual labels:  module
lambda2js
Converts a C# expression tree (from Linq namespace) to a syntatically correct javascript code.
Stars: ✭ 51 (+155%)
Mutual labels:  lambda
default-gateway
Get the default network gateway, cross-platform.
Stars: ✭ 77 (+285%)
Mutual labels:  module
Neural-Plot-Development
A Library for visualizing Neural Networks of the TensorFlow/Keras models.
Stars: ✭ 16 (-20%)
Mutual labels:  module
terraform-aws-efs-backup
Terraform module designed to easily backup EFS filesystems to S3 using DataPipeline
Stars: ✭ 40 (+100%)
Mutual labels:  lambda
lambda-lite-js
a tiny FUNCITONAL LANGUAGE implemented by javascript. 一个函数式语言,使用 js 实现。
Stars: ✭ 77 (+285%)
Mutual labels:  lambda
fastlane-plugin-create xcframework
Fastlane plugin that creates xcframework for given list of destinations 🚀
Stars: ✭ 58 (+190%)
Mutual labels:  module
AppSystemizer
AppSystemizer
Stars: ✭ 52 (+160%)
Mutual labels:  module
aws-cloudformation-cognito-identity-pool
A Lambda-backed Custom Resource for a Cognito Identity Pool in CloudFormation
Stars: ✭ 35 (+75%)
Mutual labels:  lambda
tech1-temple-aws
AWS Proofs of Concepts repository. No Longer Supported
Stars: ✭ 32 (+60%)
Mutual labels:  lambda
serverless-graalvm-demo
Sample serverless application written in Java compiled with GraalVM native-image
Stars: ✭ 132 (+560%)
Mutual labels:  lambda
s3-monitoring
No description or website provided.
Stars: ✭ 14 (-30%)
Mutual labels:  lambda

terraform-lambda-fixed-ip

Provide a fixed IP (ElasticIP) to your AWS Lambdas.

This is extremely useful when you need to connect to a service that filters IPs. Typical services use firewalls that can whitelist some IPs, by allowing your ElasticIP in the firewall rules you will be able to connect to the service from your Lambda.

How it works

  • This terraform module creates a VPC in the eu-west-1 region (you can use a different region)
  • Creates a public and a private networks
  • Routes all the traffic from the private network to the public network
  • Routes all the traffic from the public network to internet
  • Assigns an elastic IP to the traffic coming from the public network, so it has a fixed IP

How to use it

  • Include this module in your code:
module "lambdas_vpc" {
    source  = "github.com/ainestal/terraform-lambda-fixed-ip?ref=0.2"
}
  • Plan terraform to see what is going to do:
terraform plan
  • If you like what you see, apply the changes:
terraform apply
  • Create your Lambdas inside the private subnet.
  • You can reference the vpc_id and the elastic ip id. If you are terraforming your lambda, the lambda_function example would look like:
resource "aws_lambda_function" "test_lambda" {
  filename         = "lambda_function_payload.zip"
  function_name    = "lambda_function_name"
  role             = "${aws_iam_role.iam_for_lambda.arn}"
  handler          = "exports.test"
  source_code_hash = "${base64sha256(file("lambda_function_payload.zip"))}"
  runtime          = "nodejs4.3"

  environment {
    variables = {
      foo = "bar"
    }
  }
  
  // Include this Lambda in the VPC that provides a Elastic IP
  vpc_config {
    subnet_ids = [ ${module.lambdas_vpc.private_subnet_id} ]

    security_group_ids = [ <THE ID OF YOUR SECURITY GROUP> ]
  }
}
  • When your Lambdas run they will use your ElasticIP (and it will always be the same if you don't change it).

Dependencies

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].