Skip to content

wandexdev/AWS-deployment-using-Terraform-and-Ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AWS Deployment Automation Using Terraform and Ansible

Archeiture Diagram

Scenario:

You're tasked to deploy webpages in multiple EC2 instances and attach to a Load Balancer all set up using Terraform. Ansible would handle the instances configurations by working with the output from terraform. Terraform should also link the load balncer's domain to a sub-domain called terraform-test.yourdomain.com of your custom domain name, request and validate an ssl certifcate. Visiting terraform-test.yourdomain.me should display all instances webpages.

Essentials:

  • An AWS Account.
  • A linux/mac system or instance or virtual machine or droplets
  • Be logged in an IAM user with Admin priviledges
  • A custom domain name (sub-domain would be mapped)
  • An S3 bucket to store the terraform state files remotely

Procedures:

I am currently writing a well detailed article with all research I did on this, note this link when it drops. Here is a summary of the steps.

  • Install latest Terraform on the command line
  • Install latest Ansible on th ecommand line
  • Create a terraform folder (working directory), cd into it and code to open vs code
  • Install the terraform extension by Anton Kulikov
  • Install AWS CLI and Configure with aws configure
    • fill up outputs with credentials previously created from IAM user
    • add preferred region
    • Test configuration details with aws configure list
    • No need to create environment variables as env | grep AWS will not recognize the enviroment variables set in another terminal tab hence aws configure is appropriate for global setup.
  • Create a variables.tf file to declare variables used in this project and a terraform.tfvars file to input the variable values.
  • Create a s3_backend.tf file to store remote state files as this ensures multiples users or CI server gets the latest state data before running terraform. Its also more secure. Fill up

Final Output: visit secured terraform-test.wandexdev.me

Instance 1 i1 Instance 2 i2 instance 3 i3

Screenshots:

  • Remote Backend: s3

  • Network:

    • VPC vpc
    • SUBNETS subnets
    • Custom-DEFAULT ROUTE TABLES rt
    • INTERNET GATEWAY (IGW) igw
    • SECURITY GROUPS (Instances and ALB) sg
  • Servers:

    • Instances instances
    • KEY PAIR kp
    • APPLICATION LOAD BALANCERS (ALB) ALB

About

AWS Architechture Deployment Automated Using Terraform and Ansible

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages