https://github.com/mich0232/packer-nginx-lb-aws
Packer template to build AWS AMI serving as low-cost NGINX Load Balancer
https://github.com/mich0232/packer-nginx-lb-aws
Last synced: 4 months ago
JSON representation
Packer template to build AWS AMI serving as low-cost NGINX Load Balancer
- Host: GitHub
- URL: https://github.com/mich0232/packer-nginx-lb-aws
- Owner: Mich0232
- Created: 2023-02-21T20:58:29.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-02-21T20:58:48.000Z (over 3 years ago)
- Last Synced: 2025-12-03T17:19:50.579Z (7 months ago)
- Language: HCL
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NGINX Load Balancer for AWS [packer]
This repo cotains configuration for creating custom AMI using the HashiCorp Packer tool.
Custom AMI will contain NGINX service serving as a load balancer.
## Requirements
`packer` - [How to install Packer](https://developer.hashicorp.com/packer/downloads)
## Building
```shell
cd src && packer build -var-file=variables.pkr.hcl nginx_lb.pkr.hcl
```
[How to install NGINX dynamic module](https://www.youtube.com/watch?v=AsTDPRnBayI)
## Target group API
`API` - [ngx_dynamic_upstream](https://github.com/cubicdaiya/ngx_dynamic_upstream.git)
### Add server to TG
```shell
curl "http://127.0.0.1:6000/dynamic?upstream=zone_for_backends&add=&server=127.0.0.1:6004"
```
### Remove server from TG
```shell
curl "http://127.0.0.1:6000/dynamic?upstream=zone_for_backends&remove=&server=127.0.0.1:6003"
```
## Lower costs
Using AWS-managed load balancers we cannot select any tier or size of our instance, combining that with no Reserved Instances or Savings Plan features, Application Load Balancers start at ~20 USD per month.
ELB can be responsible for large % of your costs, especially in very small applications. With NGINX LB you're paying only for the EC2 instance, what gives you ability to better manage your costs.
## Features
- Logging - TBD
- Health Checks - TBD
- Instance registration/deregistration - TDB