Skip to content

elan-devops/terraform-nginx-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a simple NGINX sever load balanced with ALB and ASG using Terraform and Python

Usage:

python cli.py [args]

Skeleton:

.
├── README.md
├── alb-asg.tf
├── cli.py
├── ec2-instances.tf
├── nginx.sh
├── nginx.tpl
├── provider.tf
├── secgroup.tf
├── terraform-cli.pem
├── terraform.tfstate
├── terraform.tfstate.backup
├── variables.tf
└── vpc.tf

Pre-requisites:

Install Terraform
    STEP 1:
    1. Terraform v0.13.0
    2. provider registry.terraform.io/hashicorp/aws v3.2.0

    STEP 2:

    1. ADD AWS credentials in ~/.aws/config
    2. Example:

      [default] aws_access_key_id = Access key aws_secret_access_key = Secret_key

    STEP 3:

    Create aws keypair to ssh access to ec2 instances

    STEP 4:

    ec2-instances: Replace with your aws-key private_key file path = "${file("{file_path}/terraform-cli.pem")}"

Description:

VPC - CIDR of 192.168.0.0/16 with Public Subnet for each AZs

SG - Ingress on 80 and ssh connection

ASG-ALB Min - 2, Max: 6 Health check on EC2 with sg for port 80

Output - LB DNS URL

Improvement

Instead of "provisioner - ssh connection/ remote-exec" --> "user-data"

Cli - arg parser

This has to be user-data = "${file("terraform-cli.pem")}"

About

NGINX+ALB+ASG+CLI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published